summaryrefslogtreecommitdiff
path: root/test/json/json_parser_test.rb
diff options
context:
space:
mode:
authortompng <[email protected]>2025-01-20 20:44:37 +0900
committerJean Boussier <[email protected]>2025-01-20 14:20:55 +0100
commit525d7a68e4e08aca39ef8ec6af1e78d489cf0bd5 (patch)
treebacf151b2c94cefb5d4337a941ba336106bbe44c /test/json/json_parser_test.rb
parentc026e44bb557dc42516785beba00452fa462738e (diff)
[ruby/json] Raise parse error on invalid comments
https://github.com/ruby/json/commit/2f57f40467
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12602
Diffstat (limited to 'test/json/json_parser_test.rb')
-rw-r--r--test/json/json_parser_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/json/json_parser_test.rb b/test/json/json_parser_test.rb
index bca8ff287c..3f009de57c 100644
--- a/test/json/json_parser_test.rb
+++ b/test/json/json_parser_test.rb
@@ -406,6 +406,11 @@ class JSONParserTest < Test::Unit::TestCase
}
JSON
assert_equal({ "key1" => "value1" }, parse(json))
+ assert_equal({}, parse('{} /**/'))
+ assert_raise(ParserError) { parse('{} /* comment not closed') }
+ assert_raise(ParserError) { parse('{} /*/') }
+ assert_raise(ParserError) { parse('{} /x wrong comment') }
+ assert_raise(ParserError) { parse('{} /') }
end
def test_nesting