summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-04-29 13:45:32 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-04-29 13:47:20 +0900
commit1432471a759dc0cbc80c53766894dba45e6da887 (patch)
tree200f87a1d197dacdacba52f0e74957bc25268821 /test
parent23375c8b81e07644517e5ad985b2fbf5e1b5d545 (diff)
downloadruby-1432471a759dc0cbc80c53766894dba45e6da887.tar.gz
Disallow also CR in here-doc identifier
* parse.y (heredoc_identifier): CR in here-document identifier might or might not result in a syntax error, by the EOL code. make a syntax error regardless of the EOL code.
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_syntax.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 66adeb1c09..771764720b 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -857,6 +857,12 @@ eom
assert_syntax_error("<<\"EOS\n\"\nEOS\n", /unterminated/)
end
+ def test_unterminated_heredoc_cr
+ %W[\r\n \n].each do |nl|
+ assert_syntax_error("<<\"\r\"#{nl}\r#{nl}", /unterminated/, nil, "CR with #{nl.inspect}")
+ end
+ end
+
def test__END___cr
assert_syntax_error("__END__\r<<<<<\n", /unexpected <</)
end