From c967493b653c9af32f9850876f4ff145add33d77 Mon Sep 17 00:00:00 2001 From: nagachika Date: Tue, 23 Apr 2013 14:32:49 +0000 Subject: merge revision(s) 40346: [Backport #8284] * 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/branches/ruby_2_0_0@40427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_module.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 1e0f154bd2..06c1820853 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -1675,6 +1675,13 @@ class TestModule < Test::Unit::TestCase end 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) -- cgit v1.2.3