summaryrefslogtreecommitdiff
path: root/test/json
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-11 21:23:16 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-11 21:23:16 +0000
commit5d397b488e190b4c3012e1ec146dc6161f7c3952 (patch)
treec00b0656d5b1ad90971e8c6a60005e0dec90b747 /test/json
parent91799a2fd95ac0e393d950104c5476b4cef616f7 (diff)
merges r30791 and r30792 from trunk into ruby_1_9_2.
-- * ext/json/parser/parser.h (GET_PARSER): check if initialized. [ruby-core:35079] * ext/json/parser/parser.rl (cParser_initialize): ditto. -- * ext/json/parser/parser.h (GET_PARSER): raise TypeError. * ext/json/parser/parser.rl (cParser_initialize): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@31508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/json')
-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 f5a432f8bd..4cf5972b58 100755
--- a/test/json/test_json.rb
+++ b/test/json/test_json.rb
@@ -337,4 +337,11 @@ EOT
json5 = JSON([orig = 1 << 64])
assert_equal orig, JSON[json5][0]
end
+
+ def test_allocate
+ json = JSON::Parser.new("{}")
+ assert_raises(TypeError, '[ruby-core:35079]') {json.__send__(:initialize, "{}")}
+ json = JSON::Parser.allocate
+ assert_raises(TypeError, '[ruby-core:35079]') {json.source}
+ end
end