summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFlorian Frank <flori@ping.de>2015-06-15 22:39:32 +0200
committerFlorian Frank <flori@ping.de>2015-06-15 22:47:04 +0200
commit500738e0052eebb306b9e972e2b70065972e45be (patch)
tree874076eda0e85250080c93d101673009c3a390b3 /tests
parent68ce5b6b564f87edd1d4f005a39a230e544d15e8 (diff)
downloadjson-500738e0052eebb306b9e972e2b70065972e45be.tar.gz
Disallow usage of symbolize_names and create_additions
Diffstat (limited to 'tests')
-rw-r--r--tests/json_common_interface_test.rb6
-rw-r--r--tests/json_parser_test.rb3
2 files changed, 5 insertions, 4 deletions
diff --git a/tests/json_common_interface_test.rb b/tests/json_common_interface_test.rb
index 1fca19d..9aae2c6 100644
--- a/tests/json_common_interface_test.rb
+++ b/tests/json_common_interface_test.rb
@@ -67,10 +67,8 @@ class JSONParserTest < Test::Unit::TestCase
end
def test_load_with_options
- small_hash = JSON("foo" => 'bar')
- symbol_hash = { :foo => 'bar' }
- assert_equal symbol_hash,
- JSON.load(small_hash, nil, :symbolize_names => true)
+ json = '{ "foo": NaN }'
+ assert JSON.load(json, nil, :allow_nan => true)['foo'].nan?
end
def test_dump
diff --git a/tests/json_parser_test.rb b/tests/json_parser_test.rb
index 6755e6b..b21e7ec 100644
--- a/tests/json_parser_test.rb
+++ b/tests/json_parser_test.rb
@@ -183,6 +183,9 @@ class JSONParserTest < Test::Unit::TestCase
parse('{"foo":"bar", "baz":"quux"}'))
assert_equal({ :foo => "bar", :baz => "quux" },
parse('{"foo":"bar", "baz":"quux"}', :symbolize_names => true))
+ assert_raise(ArgumentError) do
+ parse('{}', :symbolize_names => true, :create_additions => true)
+ end
end
def test_parse_comments