summaryrefslogtreecommitdiff
path: root/test/ruby/test_module.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-18 07:59:06 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-18 07:59:06 +0000
commit335dfa1255eb38d765d3b35d8b9f9d176eb5e830 (patch)
tree93c54175c94adbf9b1605e3c31c57e44412f9ac9 /test/ruby/test_module.rb
parenta4188556d3735aec2fba15372f73826c16d1af05 (diff)
vm_method.c: fix visibility on anonymous module
* vm_method.c (rb_mod_public_method): fix visibility on anonymous module. set visibility of singleton method, not method in base class. [ruby-core:54404] [Bug #8284] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r--test/ruby/test_module.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 26fec5e899..9342a78617 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -1721,6 +1721,13 @@ class TestModule < Test::Unit::TestCase
assert_equal [mod, obj.singleton_class, Object], obj.singleton_class.ancestors.first(3)
end
+ def test_anonymous_module_public_class_method
+ bug8284 = '[ruby-core:54404] [Bug #8284]'
+ assert_raise(NoMethodError) {Object.define_method}
+ Module.new.public_class_method(:define_method)
+ assert_raise(NoMethodError, bug8284) {Object.define_method}
+ end
+
private
def assert_top_method_is_private(method)