summaryrefslogtreecommitdiff
path: root/test/ripper/test_scanner_events.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-12-01 13:04:42 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-12-01 15:04:30 +0900
commitd503e1b95a40e45d7767e0175de60092de4ba54e (patch)
tree3804881a722be63f4a2b6952cf6f6198fd615c80 /test/ripper/test_scanner_events.rb
parent52c2660163240a494b65eb9942c3978896ed807b (diff)
[Bug #20030] dispatch invalid escaped character without ignoring it
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 8434cc9c40..9739cdb1eb 100644
--- a/test/ripper/test_scanner_events.rb
+++ b/test/ripper/test_scanner_events.rb
@@ -991,6 +991,12 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
assert_equal("\e", err[2])
end
+ def test_invalid_escape
+ err = nil
+ assert_equal ["\\C-\u{3042}"], scan('tstring_content', %["\\C-\u{3042}"]) {|*e| err = e}
+ assert_equal [:on_parse_error, "Invalid escape character syntax", "\\C-\u{3042}"], err
+ end
+
def test_invalid_hex_escape
err = nil
assert_equal ['U'], scan('tstring_content', '"\\xU"') {|*e| err = e}