summaryrefslogtreecommitdiff
path: root/tests/json_common_interface_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tests/json_common_interface_test.rb')
-rw-r--r--tests/json_common_interface_test.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/json_common_interface_test.rb b/tests/json_common_interface_test.rb
index 6485328..382c77b 100644
--- a/tests/json_common_interface_test.rb
+++ b/tests/json_common_interface_test.rb
@@ -70,6 +70,12 @@ class JSONCommonInterfaceTest < Test::Unit::TestCase
assert JSON.load(json, nil, :allow_nan => true)['foo'].nan?
end
+ def test_load_null
+ assert_equal nil, JSON.load(nil, nil, :allow_null => true)
+ assert_raises(TypeError) { JSON.load(nil, nil, :allow_null => false) }
+ assert_raises(JSON::ParserError) { JSON.load('', nil, :allow_null => false) }
+ end
+
def test_dump
too_deep = '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]'
assert_equal too_deep, dump(eval(too_deep))
@@ -92,7 +98,6 @@ class JSONCommonInterfaceTest < Test::Unit::TestCase
assert_equal max_nesting, JSON.dump_default_options[:max_nesting]
end
-
def test_JSON
end
end