diff options
Diffstat (limited to 'tests/test_json.rb')
-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)) |