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

forwardable.rb: full qualify names

* lib/forwardable.rb (def_instance_delegator, def_single_delegator):
  match backtraces against ::Forwardable in case the target class
  is a subclass of BasicObject and does not include Kernel.
  [ruby-core:71176] [Bug #11616]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-10-23 22:29:14 +00:00
parent 92d5da521d
commit 4e1ee809bb
3 changed files with 22 additions and 2 deletions

View file

@ -110,6 +110,19 @@ class TestForwardable < Test::Unit::TestCase
assert_not_match(/\/forwardable\.rb/, e.backtrace[0])
end
class Foo2 < BasicObject
extend ::Forwardable
def_delegator :bar, :baz
end
def test_basicobject_subclass
bug11616 = '[ruby-core:71176] [Bug #11616]'
assert_raise_with_message(NameError, /`bar'/, bug11616) {
Foo2.new.baz
}
end
private
def forwardable_class(&block)