summaryrefslogtreecommitdiff
path: root/test/-ext-
diff options
context:
space:
mode:
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 ba5a1622317..82a64034b16 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