parse.y: symbol names must be ascii-compatible

* parse.y (rb_enc_symname_type): encoding of symbol names must be
  ascii-compatible, reject ascii-incompatible encodings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-02-05 06:49:35 +00:00
parent c5038b22eb
commit e10e309dce
2 changed files with 6 additions and 0 deletions

View file

@ -651,6 +651,11 @@ class TestModule < Test::Unit::TestCase
assert_raise(NameError) { c1.const_set(:foo, :foo) }
assert_raise(NameError) { c1.const_set("bar", :foo) }
assert_raise(TypeError) { c1.const_set(1, :foo) }
assert_nothing_raised(NameError) { c1.const_set("X\u{3042}", :foo) }
assert_raise(NameError) { c1.const_set("X\u{3042}".encode("utf-16be"), :foo) }
assert_raise(NameError) { c1.const_set("X\u{3042}".encode("utf-16le"), :foo) }
assert_raise(NameError) { c1.const_set("X\u{3042}".encode("utf-32be"), :foo) }
assert_raise(NameError) { c1.const_set("X\u{3042}".encode("utf-32le"), :foo) }
end
def test_const_get_invalid_name