diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/json_addition_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/json_addition_test.rb b/tests/json_addition_test.rb index a028e0f..61625f8 100644 --- a/tests/json_addition_test.rb +++ b/tests/json_addition_test.rb @@ -5,6 +5,7 @@ require 'json/add/complex' require 'json/add/rational' require 'json/add/bigdecimal' require 'json/add/ostruct' +require 'json/add/set' require 'date' class JSONAdditionTest < Test::Unit::TestCase @@ -190,4 +191,13 @@ class JSONAdditionTest < Test::Unit::TestCase o.foo = { 'bar' => true } assert_equal o, parse(JSON(o), :create_additions => true) end + + def test_set + s = Set.new([:a, :b, :c, :a]) + assert_equal s, JSON.parse(JSON(s), :create_additions => true) + ss = SortedSet.new([:d, :b, :a, :c]) + ss_again = JSON.parse(JSON(ss), :create_additions => true) + assert_kind_of ss.class, ss_again + assert_equal ss, ss_again + end end |