From 58c5011b3e26643b1c50aac8d0aab094b6899dd0 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Mon, 31 Oct 2016 08:43:54 +0000 Subject: [PATCH] * 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 --- ChangeLog | 5 +++++ test/test_forwardable.rb | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/ChangeLog b/ChangeLog index e436d130a3..9b65e6bad7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Oct 31 17:36:04 2016 Code Ahss + + * test/test_forwardable.rb (TestForwardable#test_on_private_method): + add test for [Bug #12782] [Bug #12840] + Mon Oct 31 11:08:51 2016 Samuel Williams * lib/uri/generic.rb (URI::Generic#merge): merge merge0. diff --git a/test/test_forwardable.rb b/test/test_forwardable.rb index 0d3fe19213..e48dbfe18f 100644 --- a/test/test_forwardable.rb +++ b/test/test_forwardable.rb @@ -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(