summaryrefslogtreecommitdiff
path: root/test/json
diff options
context:
space:
mode:
authortompng <[email protected]>2025-01-20 21:31:39 +0900
committerJean Boussier <[email protected]>2025-01-20 14:20:55 +0100
commit86b262179d94e864243419ac0425cd3f85f970de (patch)
treebc3f18a27b70f25d3fac6f6cd6f6e015ad1a279d /test/json
parent525d7a68e4e08aca39ef8ec6af1e78d489cf0bd5 (diff)
[ruby/json] Reject invalid number: `-` `-.1` `-e0`
https://github.com/ruby/json/commit/b9bfeecfa9
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12602
Diffstat (limited to 'test/json')
-rw-r--r--test/json/json_parser_test.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/json/json_parser_test.rb b/test/json/json_parser_test.rb
index 3f009de57c..d1f084bb63 100644
--- a/test/json/json_parser_test.rb
+++ b/test/json/json_parser_test.rb
@@ -109,6 +109,9 @@ class JSONParserTest < Test::Unit::TestCase
assert_raise(JSON::ParserError) { parse('-023.12') }
assert_raise(JSON::ParserError) { parse('023e12') }
assert_raise(JSON::ParserError) { parse('-023e12') }
+ assert_raise(JSON::ParserError) { parse('-') }
+ assert_raise(JSON::ParserError) { parse('-.1') }
+ assert_raise(JSON::ParserError) { parse('-e0') }
assert_equal(23, parse('23'))
assert_equal(-23, parse('-23'))
assert_equal_float(3.141, parse('3.141'))