mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/test_forwardable.rb (TestForwardable#test_on_private_method): add test for [Bug #12782] [Bug #12840]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b37af6212e
commit
58c5011b3e
2 changed files with 16 additions and 0 deletions
|
@ -285,6 +285,17 @@ class TestForwardable < Test::Unit::TestCase
|
|||
assert_equal(42, -obj)
|
||||
end
|
||||
|
||||
def test_on_private_method
|
||||
cls = Class.new do
|
||||
private def foo; :foo end
|
||||
extend Forwardable
|
||||
def_delegator :itself, :foo, :bar
|
||||
end
|
||||
assert_warn(/forwarding to private method/) do
|
||||
assert_equal(:foo, cls.new.bar)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def forwardable_class(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue