summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFlorian Frank <flori@ping.de>2012-04-27 19:49:20 +0200
committerFlorian Frank <flori@ping.de>2012-04-27 20:24:12 +0200
commit7f64f211d36e598a3c54a19d9caad9e3f9dca402 (patch)
tree90893175a786ff0cf90b63aba05ab6cc11b2387b /tests
parent7c6e8cd98fb7d841f08e083040b8316f7c752157 (diff)
downloadjson-7f64f211d36e598a3c54a19d9caad9e3f9dca402.tar.gz
Throw exception unless source is a string
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_json.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/test_json.rb b/tests/test_json.rb
index 7beaaac..4b4bc55 100755
--- a/tests/test_json.rb
+++ b/tests/test_json.rb
@@ -109,6 +109,8 @@ class TestJSON < Test::Unit::TestCase
def test_parse_json_primitive_values
assert_raise(JSON::ParserError) { JSON.parse('') }
assert_raise(JSON::ParserError) { JSON.parse('', :quirks_mode => true) }
+ assert_raise(TypeError) { JSON::Parser.new(nil).parse }
+ assert_raise(TypeError) { JSON::Parser.new(nil, :quirks_mode => true).parse }
assert_raise(TypeError) { JSON.parse(nil) }
assert_raise(TypeError) { JSON.parse(nil, :quirks_mode => true) }
assert_raise(JSON::ParserError) { JSON.parse(' /* foo */ ') }