summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFlorian Frank <flori@ping.de>2009-11-25 02:19:07 +0100
committerFlorian Frank <flori@ping.de>2009-11-25 02:19:07 +0100
commit5f420debe6291197e97965b859c4a51f587c0144 (patch)
tree75249c550346bd071ff10a6aa27d7b3b2f965e91 /tests
parent31132c364e92eb887f7d1c4178f71930a8e35c5d (diff)
downloadjson-5f420debe6291197e97965b859c4a51f587c0144.tar.gz
implemented symbolize_names feature, #8
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_json.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_json.rb b/tests/test_json.rb
index 736c57b..3d26ddb 100755
--- a/tests/test_json.rb
+++ b/tests/test_json.rb
@@ -302,6 +302,13 @@ EOT
assert_equal too_deep, ok
end
+ def test_symbolize_names
+ assert_equal({ "foo" => "bar", "baz" => "quux" },
+ JSON.parse('{"foo":"bar", "baz":"quux"}'))
+ assert_equal({ :foo => "bar", :baz => "quux" },
+ JSON.parse('{"foo":"bar", "baz":"quux"}', :symbolize_names => true))
+ end
+
def test_load_dump
too_deep = '[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]'
assert_equal too_deep, JSON.dump(eval(too_deep))