mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
adding test coverage for invalid attribute names
Fixes #171 on github git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a5849245c6
commit
2caa432c6a
1 changed files with 13 additions and 0 deletions
|
@ -1452,4 +1452,17 @@ class TestModule < Test::Unit::TestCase
|
||||||
assert_nothing_raised(NoMethodError, Bug6891) {Class.new(x)}
|
assert_nothing_raised(NoMethodError, Bug6891) {Class.new(x)}
|
||||||
assert_equal(['public', 'protected'], list)
|
assert_equal(['public', 'protected'], list)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_invalid_attr
|
||||||
|
%w[
|
||||||
|
foo?
|
||||||
|
@foo
|
||||||
|
@@foo
|
||||||
|
$foo
|
||||||
|
].each do |name|
|
||||||
|
assert_raises(NameError) do
|
||||||
|
Module.new { attr_accessor name.to_sym }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue