From 2caa432c6a3276c1793cc221fd876df6af12c805 Mon Sep 17 00:00:00 2001 From: tenderlove Date: Mon, 27 Aug 2012 17:57:32 +0000 Subject: [PATCH] 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 --- test/ruby/test_module.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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