1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/json/parser/parser.h (GET_PARSER): check if initialized.

[ruby-core:35079]
* ext/json/parser/parser.rl (cParser_initialize): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2011-02-05 01:30:01 +00:00
parent bc1e4b4e2a
commit 9cc62abc6b
5 changed files with 34 additions and 7 deletions

View file

@ -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