1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* proc.c (mnew): don't check visibility of method body if public

ZSUPER method is found.  [ruby-dev:39767]

* test/ruby/test_method.rb: add a test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2010-01-08 14:40:38 +00:00
parent 479a3c4c8b
commit 8e8bb6c173
3 changed files with 30 additions and 2 deletions

View file

@ -312,4 +312,19 @@ class TestMethod < Test::Unit::TestCase
assert_equal([[:req, :a], [:opt, :b], [:rest, :c], [:req, :d], [:block, :e]], self.class.instance_method(:pmo7).parameters)
assert_equal([[:req], [:block, :b]], self.class.instance_method(:pma1).parameters)
end
def test_public_method_with_zsuper_method
c = Class.new
c.class_eval do
def foo
:ok
end
private :foo
end
d = Class.new(c)
d.class_eval do
public :foo
end
assert_equal(:ok, d.new.public_method(:foo).call)
end
end