diff options
author | Florian Frank <flori@ping.de> | 2009-11-25 02:19:07 +0100 |
---|---|---|
committer | Florian Frank <flori@ping.de> | 2009-11-25 02:19:07 +0100 |
commit | 5f420debe6291197e97965b859c4a51f587c0144 (patch) | |
tree | 75249c550346bd071ff10a6aa27d7b3b2f965e91 /tests | |
parent | 31132c364e92eb887f7d1c4178f71930a8e35c5d (diff) | |
download | json-5f420debe6291197e97965b859c4a51f587c0144.tar.gz |
implemented symbolize_names feature, #8
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test_json.rb | 7 |
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)) |