summaryrefslogtreecommitdiff
path: root/test/json/test_json.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/json/test_json.rb')
-rwxr-xr-xtest/json/test_json.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/json/test_json.rb b/test/json/test_json.rb
index 00e52f511af..cb700852422 100755
--- a/test/json/test_json.rb
+++ b/test/json/test_json.rb
@@ -391,4 +391,11 @@ EOT
json5 = JSON([orig = 1 << 64])
assert_equal orig, JSON[json5][0]
end
+
+ def test_allocate
+ json = JSON::Parser.new("{}")
+ assert_raises(ArgumentError, '[ruby-core:35079]') {json.__send__(:initialize, "{}")}
+ json = JSON::Parser.allocate
+ assert_raises(ArgumentError, '[ruby-core:35079]') {json.source}
+ end
end