mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* parse.y (parser_tokadd_utf8, parser_tokadd_string): allow NUL
containing symbol literals, as well as String#to_sym. [ruby-dev:41447] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
abeb6dce85
commit
5d394118ff
4 changed files with 22 additions and 27 deletions
|
@ -57,12 +57,14 @@ EOS
|
|||
assert_equal(:"\u{41}", :"\u0041")
|
||||
assert_equal(:ü, :"\u{fc}")
|
||||
|
||||
# the NUL character is not allowed in symbols
|
||||
assert_raise(SyntaxError) { eval %q(:"\u{0}")}
|
||||
assert_raise(SyntaxError) { eval %q(:"\u0000")}
|
||||
assert_raise(SyntaxError) { eval %q(:"\u{fc 0 0041}")}
|
||||
assert_raise(SyntaxError) { eval %q(:"\x00")}
|
||||
assert_raise(SyntaxError) { eval %q(:"\0")}
|
||||
# the NUL character is allowed in symbols
|
||||
bug = '[ruby-dev:41447]'
|
||||
sym = "\0".to_sym
|
||||
assert_nothing_raised(SyntaxError, bug) {assert_equal(sym, eval(%q(:"\u{0}")))}
|
||||
assert_nothing_raised(SyntaxError, bug) {assert_equal(sym, eval(%q(:"\u0000")))}
|
||||
assert_nothing_raised(SyntaxError, bug) {assert_equal("\u{fc}\0A".to_sym, eval(%q(:"\u{fc 0 0041}")))}
|
||||
assert_nothing_raised(SyntaxError, bug) {assert_equal(sym, eval(%q(:"\x00")))}
|
||||
assert_nothing_raised(SyntaxError, bug) {assert_equal(sym, eval(%q(:"\0")))}
|
||||
end
|
||||
|
||||
def test_regexp
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue