summaryrefslogtreecommitdiff
path: root/test/test_delegate.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-01-21 11:47:04 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-01-30 22:13:29 +0900
commit9bcf4f3db26249772c983896ebbc9ff41f4614db (patch)
tree3a93e3ad93d71eeaaa873493b16819c88bbc311f /test/test_delegate.rb
parent3893a8dd42fb3bbd71750648c3c0de118955a6ea (diff)
delegate.rb: fixed keyword arguments in DelegateClass
`Delegator.delegating_block` should delegate keyword arguments separately. [ruby-core:96949]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2852
Diffstat (limited to 'test/test_delegate.rb')
-rw-r--r--test/test_delegate.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_delegate.rb b/test/test_delegate.rb
index 80bf416..9c47743 100644
--- a/test/test_delegate.rb
+++ b/test/test_delegate.rb
@@ -343,4 +343,12 @@ class TestDelegateClass < Test::Unit::TestCase
assert_equal(1, delegate.bar)
assert_raise(NoMethodError, /undefined method `foo' for/) { delegate.foo }
end
+
+ def test_keyword_argument
+ k = EnvUtil.labeled_class("Target") do
+ def test(a, k:) [a, k]; end
+ end
+ a = DelegateClass(k).new(k.new)
+ assert_equal([1, 0], a.test(1, k: 0))
+ end
end