diff options
author | Florian Frank <flori@ping.de> | 2011-11-03 13:04:02 +0100 |
---|---|---|
committer | Florian Frank <flori@ping.de> | 2011-11-03 13:04:02 +0100 |
commit | 6bd324502763b85914e98bcd9eb97615306146a4 (patch) | |
tree | db2a965cfe53f47c488e65096269a07a16144b5a /tests | |
parent | 5dcfa3711a14a6a027ce6b2b62d9117fb78da1b7 (diff) | |
download | json-6bd324502763b85914e98bcd9eb97615306146a4.tar.gz |
always raise type error when parsing nil
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test_json.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/test_json.rb b/tests/test_json.rb index eafd758..5492b8e 100755 --- a/tests/test_json.rb +++ b/tests/test_json.rb @@ -107,6 +107,8 @@ class TC_JSON < 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.parse(nil) } + assert_raise(TypeError) { JSON.parse(nil, :quirks_mode => true) } assert_raise(JSON::ParserError) { JSON.parse(' /* foo */ ') } assert_raise(JSON::ParserError) { JSON.parse(' /* foo */ ', :quirks_mode => true) } parser = JSON::Parser.new('null') |