diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-05-30 12:35:27 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-05-30 12:38:50 +0900 |
commit | 4a31c1e45d12b7813096948616f8a03224f20ac8 (patch) | |
tree | ade1b8f17462088ac12b6b00aff5ac62d76db95c /test/ruby | |
parent | cb520e76237d3884b768f4f68120beb13fcf1f04 (diff) | |
download | ruby-4a31c1e45d12b7813096948616f8a03224f20ac8.tar.gz |
parse.y: continue after heredoc error
* parse.y: continue parsing the rest of the here-document starting
line, after the terminator was not found.
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_syntax.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 4e52bc4a72..6fdca37924 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -901,6 +901,12 @@ eom assert_syntax_error("puts <<""EOS\n""ng\n""EOS\r""NO\n", /can't find string "EOS" anywhere before EOF/) end + def test_heredoc_no_terminator + assert_syntax_error("puts <<""A\n", /can't find string "A" anywhere before EOF/) + assert_syntax_error("puts <<""A + <<""B\n", /can't find string "A" anywhere before EOF/) + assert_syntax_error("puts <<""A + <<""B\n", /can't find string "B" anywhere before EOF/) + end + def test_unterminated_heredoc assert_syntax_error("<<\"EOS\n\nEOS\n", /unterminated/) assert_syntax_error("<<\"EOS\n\"\nEOS\n", /unterminated/) |