summaryrefslogtreecommitdiff
path: root/test/ripper
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-05 06:28:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-05 06:28:07 +0000
commit2ac460af94948caa8af7c13648a0d3a7e46eb446 (patch)
tree9ebd2438f3a9c855d88607980bd47b1ad3744ad4 /test/ripper
parenteb78d224e3bb0747d4ae671e3aa4068d94398d00 (diff)
* parse.y (parser_here_document): should dispatch heredoc_end
scanner event on an empty here document. fixed Bug#4543. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ripper')
-rw-r--r--test/ripper/test_scanner_events.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ripper/test_scanner_events.rb b/test/ripper/test_scanner_events.rb
index 9005e46..7d5bb3c 100644
--- a/test/ripper/test_scanner_events.rb
+++ b/test/ripper/test_scanner_events.rb
@@ -66,6 +66,11 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
[[2, 0], :on_tstring_content, "heredoc\n"],
[[3, 0], :on_heredoc_end, "EOS"]],
Ripper.lex("<<EOS\nheredoc\nEOS")
+ assert_equal [[[1, 0], :on_heredoc_beg, "<<EOS"],
+ [[1, 5], :on_nl, "\n"],
+ [[2, 0], :on_heredoc_end, "EOS"]],
+ Ripper.lex("<<EOS\nEOS"),
+ "bug#4543"
assert_equal [[[1, 0], :on_regexp_beg, "/"],
[[1, 1], :on_tstring_content, "foo\nbar"],
[[2, 3], :on_regexp_end, "/"]],
@@ -654,6 +659,9 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
assert_equal [],
scan('heredoc_end', '')
assert_equal ["EOS"],
+ scan('heredoc_end', "<<EOS\nEOS"),
+ "bug#4543"
+ assert_equal ["EOS"],
scan('heredoc_end', "<<EOS\nheredoc\nEOS")
assert_equal ["EOS\n"],
scan('heredoc_end', "<<EOS\nheredoc\nEOS\n")