summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-06-20 20:10:46 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-06-20 20:10:46 +0900
commit6be402e172a537000de58a28af389cb55dd62ec8 (patch)
tree15af6549774ce5d977bbedccfa58cbdd4d72bb94 /test
parent49b83b73ef380afac78e9495e52000509119a471 (diff)
[Bug #19736] Recover after unterminated interpolation
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7963
Diffstat (limited to 'test')
-rw-r--r--test/ripper/test_lexer.rb9
-rw-r--r--test/ruby/test_parse.rb9
2 files changed, 18 insertions, 0 deletions
diff --git a/test/ripper/test_lexer.rb b/test/ripper/test_lexer.rb
index 8e8a616627..92587ae4c0 100644
--- a/test/ripper/test_lexer.rb
+++ b/test/ripper/test_lexer.rb
@@ -264,4 +264,13 @@ world"
CODE
assert_equal(code, Ripper.tokenize(code).join(""), bug)
end
+
+ def test_heredoc_unterminated_interpolation
+ code = <<~'HEREDOC'
+ <<A+1
+ #{
+ HEREDOC
+
+ assert_include(Ripper.tokenize(code).join(""), "+1")
+ end
end
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb
index 71507575a7..099050dc8d 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -1121,6 +1121,15 @@ x = __ENCODING__
assert_equal v1, v3
end
+ def test_heredoc_unterminated_interpolation
+ code = <<~'HEREDOC'
+ <<A+1
+ #{
+ HEREDOC
+
+ assert_syntax_error(code, /can't find string "A"/)
+ end
+
def test_unexpected_token_error
assert_syntax_error('"x"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', /unexpected/)
end