parse.y: zero codepoints

* parse.y (parser_tokadd_utf8): relax restriction to allow zero or
  more codepoints.  fixup r59417.

  7e8b910 (commitcomment-25602670)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-11-14 15:37:48 +00:00
parent 19ae98d5ce
commit 50702d16ab
2 changed files with 8 additions and 2 deletions

View file

@ -517,6 +517,8 @@ class TestParse < Test::Unit::TestCase
assert_syntax_error(src, /:#{__LINE__}: unterminated/o)
assert_syntax_error('"\u{100000000}"', /invalid Unicode escape/)
assert_equal("", eval('"\u{}"'))
assert_equal("", eval('"\u{ }"'))
assert_equal("\x81", eval('"\C-\M-a"'))
assert_equal("\177", eval('"\c?"'))
@ -555,6 +557,10 @@ class TestParse < Test::Unit::TestCase
assert_nothing_raised(SyntaxError, bug) do
assert_equal(sym, eval(':"foo\u{0}bar"'))
end
assert_nothing_raised(SyntaxError) do
assert_equal(:foobar, eval(':"foo\u{}bar"'))
assert_equal(:foobar, eval(':"foo\u{ }bar"'))
end
end
def test_parse_string