diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-09 14:57:04 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-09 14:57:04 +0000 |
commit | 24cf72029f0c43f59520b88d1eafee4959bcddc1 (patch) | |
tree | 5a95f9566d6389ff96fa1e8cb283fcb64ec7de67 /test/-ext-/symbol/test_inadvertent_creation.rb | |
parent | 372eb2cbfed1b7f5d7e2af1ced551ab4087c95a5 (diff) | |
download | ruby-24cf72029f0c43f59520b88d1eafee4959bcddc1.tar.gz |
object.c: avoid inadvertent symbol creation
* object.c (id_for_attr): avoid inadvertent symbol creation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/-ext-/symbol/test_inadvertent_creation.rb')
-rw-r--r-- | test/-ext-/symbol/test_inadvertent_creation.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/-ext-/symbol/test_inadvertent_creation.rb b/test/-ext-/symbol/test_inadvertent_creation.rb index ba5a162231..82a64034b1 100644 --- a/test/-ext-/symbol/test_inadvertent_creation.rb +++ b/test/-ext-/symbol/test_inadvertent_creation.rb @@ -234,5 +234,33 @@ module Test_Symbol assert_raise(NameError) {s[name] = true} assert_not_interned(name) end + + def test_invalid_attr + name = noninterned_name("*") + mod = Module.new + assert_raise(NameError) {mod.module_eval {attr(name)}} + assert_not_interned(name) + end + + def test_invalid_attr_reader + name = noninterned_name("*") + mod = Module.new + assert_raise(NameError) {mod.module_eval {attr_reader(name)}} + assert_not_interned(name) + end + + def test_invalid_attr_writer + name = noninterned_name("*") + mod = Module.new + assert_raise(NameError) {mod.module_eval {attr_writer(name)}} + assert_not_interned(name) + end + + def test_invalid_attr_accessor + name = noninterned_name("*") + mod = Module.new + assert_raise(NameError) {mod.module_eval {attr_accessor(name)}} + assert_not_interned(name) + end end end |