diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-04-29 13:45:32 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-04-29 13:47:20 +0900 |
commit | 1432471a759dc0cbc80c53766894dba45e6da887 (patch) | |
tree | 200f87a1d197dacdacba52f0e74957bc25268821 /test/ruby/test_syntax.rb | |
parent | 23375c8b81e07644517e5ad985b2fbf5e1b5d545 (diff) | |
download | ruby-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/ruby/test_syntax.rb')
-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 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 |