summaryrefslogtreecommitdiff
path: root/test/json/json_parser_test.rb
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2024-10-24 11:42:02 +0200
committerHiroshi SHIBATA <[email protected]>2024-10-26 18:44:15 +0900
commit1045b9f820b6892fb7b5b0a19a8fc959f20a8762 (patch)
tree0b831e29e7f168ea56784f49280e2a17c42f6f2f /test/json/json_parser_test.rb
parentbfdf02ea7290d1d76e457ffbb15cfef5e64bf547 (diff)
[ruby/json] Modernize heredocs
https://github.com/ruby/json/commit/fb25e94aea
Diffstat (limited to 'test/json/json_parser_test.rb')
-rw-r--r--test/json/json_parser_test.rb76
1 files changed, 38 insertions, 38 deletions
diff --git a/test/json/json_parser_test.rb b/test/json/json_parser_test.rb
index 8d3c0c17c5..ffc67ef6fd 100644
--- a/test/json/json_parser_test.rb
+++ b/test/json/json_parser_test.rb
@@ -247,50 +247,50 @@ class JSONParserTest < Test::Unit::TestCase
end
def test_parse_comments
- json = <<EOT
-{
- "key1":"value1", // eol comment
- "key2":"value2" /* multi line
- * comment */,
- "key3":"value3" /* multi line
- // nested eol comment
- * comment */
-}
-EOT
+ json = <<~JSON
+ {
+ "key1":"value1", // eol comment
+ "key2":"value2" /* multi line
+ * comment */,
+ "key3":"value3" /* multi line
+ // nested eol comment
+ * comment */
+ }
+ JSON
assert_equal(
{ "key1" => "value1", "key2" => "value2", "key3" => "value3" },
parse(json))
- json = <<EOT
-{
- "key1":"value1" /* multi line
- // nested eol comment
- /* illegal nested multi line comment */
- * comment */
-}
-EOT
+ json = <<~JSON
+ {
+ "key1":"value1" /* multi line
+ // nested eol comment
+ /* illegal nested multi line comment */
+ * comment */
+ }
+ JSON
assert_raise(ParserError) { parse(json) }
- json = <<EOT
-{
- "key1":"value1" /* multi line
- // nested eol comment
- /* legal nested multi line comment start sequence */
-}
-EOT
+ json = <<~JSON
+ {
+ "key1":"value1" /* multi line
+ // nested eol comment
+ /* legal nested multi line comment start sequence */
+ }
+ JSON
assert_equal({ "key1" => "value1" }, parse(json))
- json = <<EOT
-{
- "key1":"value1" /* multi line
- // nested eol comment
- closed multi comment */
- and again, throw an Error */
-}
-EOT
+ json = <<~JSON
+ {
+ "key1":"value1" /* multi line
+ // nested eol comment
+ closed multi comment */
+ and again, throw an Error */
+ }
+ JSON
assert_raise(ParserError) { parse(json) }
- json = <<EOT
-{
- "key1":"value1" /*/*/
-}
-EOT
+ json = <<~JSON
+ {
+ "key1":"value1" /*/*/
+ }
+ JSON
assert_equal({ "key1" => "value1" }, parse(json))
end