aboutsummaryrefslogtreecommitdiffstats
path: root/test/ripper/test_scanner_events.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-13 14:38:26 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-13 14:38:26 +0000
commitce90fcdbbd53f002e86a50be3b61a72df3588ca0 (patch)
treee7b27f71962d7b74285fd9da871f87ae1bd8fdda /test/ripper/test_scanner_events.rb
parent73c6b9d453e2e83482b928c1447f42d35013d565 (diff)
downloadruby-ce90fcdbbd53f002e86a50be3b61a72df3588ca0.tar.gz
* parse.y (parser_parse_string): flush delayed token. based on a
patch by Masaya Tarui in [ruby-dev:43762]. Bug #4544 * parse.y (yylex): revert r24557. delayed token at the end of string should be flushed already by the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ripper/test_scanner_events.rb')
-rw-r--r--test/ripper/test_scanner_events.rb17
1 files changed, 15 insertions, 2 deletions
diff --git a/test/ripper/test_scanner_events.rb b/test/ripper/test_scanner_events.rb
index 25e4b13e6c..9005e46f4e 100644
--- a/test/ripper/test_scanner_events.rb
+++ b/test/ripper/test_scanner_events.rb
@@ -67,10 +67,17 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
[[3, 0], :on_heredoc_end, "EOS"]],
Ripper.lex("<<EOS\nheredoc\nEOS")
assert_equal [[[1, 0], :on_regexp_beg, "/"],
- [[1, 1], :on_tstring_content, "foo\n"],
- [[2, 0], :on_tstring_content, "bar"],
+ [[1, 1], :on_tstring_content, "foo\nbar"],
[[2, 3], :on_regexp_end, "/"]],
Ripper.lex("/foo\nbar/")
+ assert_equal [[[1, 0], :on_regexp_beg, "/"],
+ [[1, 1], :on_tstring_content, "foo\n\u3020"],
+ [[2, 3], :on_regexp_end, "/"]],
+ Ripper.lex("/foo\n\u3020/")
+ assert_equal [[[1, 0], :on_tstring_beg, "'"],
+ [[1, 1], :on_tstring_content, "foo\n\xe3\x80\xa0"],
+ [[2, 3], :on_tstring_end, "'"]],
+ Ripper.lex("'foo\n\xe3\x80\xa0'")
end
def test_location
@@ -534,6 +541,12 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
scan('tstring_content', '"abc#{1}def"')
assert_equal ['sym'],
scan('tstring_content', ':"sym"')
+ assert_equal ['a b c'],
+ scan('tstring_content', ':"a b c"'),
+ "bug#4544"
+ assert_equal ["a\nb\nc"],
+ scan('tstring_content', ":'a\nb\nc'"),
+ "bug#4544"
end
def test_tstring_end