diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-12-01 14:52:47 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-12-01 15:04:30 +0900 |
commit | e36b9760fd0eb3bffbf1536106ce3cce02816c1f (patch) | |
tree | 498f61545cfa2c3945378e6b679ad2f96259a5d2 /test/ripper/test_scanner_events.rb | |
parent | d503e1b95a40e45d7767e0175de60092de4ba54e (diff) |
Dispatch invalid hex escape content too
Diffstat (limited to 'test/ripper/test_scanner_events.rb')
-rw-r--r-- | test/ripper/test_scanner_events.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/ripper/test_scanner_events.rb b/test/ripper/test_scanner_events.rb index 9739cdb1eb..792f19ef1a 100644 --- a/test/ripper/test_scanner_events.rb +++ b/test/ripper/test_scanner_events.rb @@ -997,13 +997,15 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase assert_equal [:on_parse_error, "Invalid escape character syntax", "\\C-\u{3042}"], err end - def test_invalid_hex_escape + def test_invalid_hex_escape_string err = nil - assert_equal ['U'], scan('tstring_content', '"\\xU"') {|*e| err = e} + assert_equal ['\\x', 'U'], scan('tstring_content', '"\\xU"') {|*e| err = e} assert_equal [:on_parse_error, "invalid hex escape", "\\x"], err + end + def test_invalid_hex_escape_regexp err = nil - assert_equal ['U'], scan('tstring_content', '/\\xU/') {|*e| err = e} + assert_equal ['\\x', 'U'], scan('tstring_content', '/\\xU/') {|*e| err = e} assert_equal [:on_parse_error, "invalid hex escape", "\\x"], err end |