aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_module.rb
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-27 17:57:32 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-27 17:57:32 +0000
commit2caa432c6a3276c1793cc221fd876df6af12c805 (patch)
tree81e9e8f80fa63403cba2198d73df918ce6b655f3 /test/ruby/test_module.rb
parenta5849245c6ffb31053ab75ab2e36163674ca7c81 (diff)
downloadruby-2caa432c6a3276c1793cc221fd876df6af12c805.tar.gz
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
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r--test/ruby/test_module.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index edcc388c8f..db3f1fde3c 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -1452,4 +1452,17 @@ class TestModule < Test::Unit::TestCase
assert_nothing_raised(NoMethodError, Bug6891) {Class.new(x)}
assert_equal(['public', 'protected'], list)
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