summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2021-05-22 16:47:24 +0900
committernagachika <nagachika@ruby-lang.org>2021-05-22 16:47:24 +0900
commitaf9de56c6fde7f9adb81d6ed0ef3067af81f90e5 (patch)
tree51766458ece2e3f456eb61510503d64a20fadafb /test/ruby
parent5e21726cda22e3cb34127751aec7e9babb4308b3 (diff)
merge revision(s) 110f242ef9b495037f59e4972ee102a8b8b372d5: [Backport #17861]
Also `\U` after control/meta is invalid [Bug #17861] As well as `\u`, `\U` should be invalid there too. And highlight including `u`/`U` not only the backslash before it. --- parse.y | 12 ++++++++++-- test/ruby/test_parse.rb | 15 +++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-)
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_parse.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb
index 5f638afa01..d316a00b47 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -562,6 +562,21 @@ class TestParse < Test::Unit::TestCase
assert_syntax_error("\"\\M-\x01\"", 'Invalid escape character syntax')
assert_syntax_error("\"\\M-\\C-\x01\"", 'Invalid escape character syntax')
assert_syntax_error("\"\\C-\\M-\x01\"", 'Invalid escape character syntax')
+
+ e = assert_syntax_error('"\c\u0000"', 'Invalid escape character syntax')
+ assert_equal(' ^~~~'"\n", e.message.lines.last)
+ e = assert_syntax_error('"\c\U0000"', 'Invalid escape character syntax')
+ assert_equal(' ^~~~'"\n", e.message.lines.last)
+
+ e = assert_syntax_error('"\C-\u0000"', 'Invalid escape character syntax')
+ assert_equal(' ^~~~~'"\n", e.message.lines.last)
+ e = assert_syntax_error('"\C-\U0000"', 'Invalid escape character syntax')
+ assert_equal(' ^~~~~'"\n", e.message.lines.last)
+
+ e = assert_syntax_error('"\M-\u0000"', 'Invalid escape character syntax')
+ assert_equal(' ^~~~~'"\n", e.message.lines.last)
+ e = assert_syntax_error('"\M-\U0000"', 'Invalid escape character syntax')
+ assert_equal(' ^~~~~'"\n", e.message.lines.last)
end
def test_question