summaryrefslogtreecommitdiff
path: root/test/ripper/test_scanner_events.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-01-02 00:27:25 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-01-02 16:12:08 +0900
commit3becc4a105bcf873fdc6e83c2a957f73718c5084 (patch)
tree05cdec0078f36a1695dd67eb58bcf30fcb4f9c38 /test/ripper/test_scanner_events.rb
parent1912bf54613f2e60e96a15906be0684a99ac9553 (diff)
[Bug #19291] Rewind to the previous line
When rewinding looking ahead after newline token, also reset the last line string, the pointers to it, and the location, not only the line number.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7054
Diffstat (limited to 'test/ripper/test_scanner_events.rb')
-rw-r--r--test/ripper/test_scanner_events.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ripper/test_scanner_events.rb b/test/ripper/test_scanner_events.rb
index 5d4b6ff5de..da3dbfb66c 100644
--- a/test/ripper/test_scanner_events.rb
+++ b/test/ripper/test_scanner_events.rb
@@ -995,4 +995,10 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
assert_equal ['U'], scan('tstring_content', '/\\xU/') {|*e| err = e}
assert_equal [:on_parse_error, "invalid hex escape", "\\x"], err
end
+
+ def test_error_token
+ src = "{a:,aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n""hello}"
+ err = scan('parse_error', src) {|*e| break e}
+ assert_equal "", err[2]
+ end
end if ripper_test