1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Added assertions for Unicode escaped CHAR scanner events

This commit is contained in:
Nobuyoshi Nakada 2019-07-06 18:46:00 +09:00
parent f296c260ef
commit 9d8855b682
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -941,9 +941,20 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
scan('CHAR', "@ivar")
assert_equal ["?\\M-H"], scan('CHAR', '?\\M-H')
assert_equal ["?\\u0041"],
scan('CHAR', "?\\u0041")
assert_equal ["?\\u{41}"],
scan('CHAR', "?\\u{41}")
err = nil
assert_equal [], scan('CHAR', '?\\M ') {|*e| err = e}
assert_equal([:on_parse_error, "Invalid escape character syntax", "?\\M "], err)
err = nil
scan('CHAR', '?\u{41 42}') {|*e| err = e}
assert_equal [:on_parse_error, "Multiple codepoints at single character literal", "42"], err
end
def test_label