summaryrefslogtreecommitdiff
path: root/test/-ext-
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-09 14:57:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-09 14:57:04 +0000
commit24cf72029f0c43f59520b88d1eafee4959bcddc1 (patch)
tree5a95f9566d6389ff96fa1e8cb283fcb64ec7de67 /test/-ext-
parent372eb2cbfed1b7f5d7e2af1ced551ab4087c95a5 (diff)
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-')
-rw-r--r--test/-ext-/symbol/test_inadvertent_creation.rb28
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 ba5a162..82a6403 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