From e10e309dcecd078df394b7a2966ec9a08f4c386d Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 5 Feb 2014 06:49:35 +0000 Subject: 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 --- test/ruby/test_module.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index ba6f273159..57a01db28e 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -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 -- cgit v1.2.3