Skip to content

Commit 788ba8a

Browse files
committed
Add test for invalid attribute names.
1 parent a584924 commit 788ba8a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/ruby/test_module.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,4 +1452,17 @@ def test_extend_module_with_protected_bmethod
14521452
assert_nothing_raised(NoMethodError, Bug6891) {Class.new(x)}
14531453
assert_equal(['public', 'protected'], list)
14541454
end
1455+
1456+
def test_invalid_attr
1457+
%w[
1458+
foo?
1459+
@foo
1460+
@@foo
1461+
$foo
1462+
].each do |name|
1463+
assert_raises(NameError) do
1464+
Module.new { attr_accessor name.to_sym }
1465+
end
1466+
end
1467+
end
14551468
end

0 commit comments

Comments
 (0)