diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-01-21 11:47:04 +0900 |
---|---|---|
committer | NARUSE, Yui <naruse@airemix.jp> | 2020-03-15 19:35:24 +0900 |
commit | d07a6dc10efa71123b36a4a3ff7d2ec6e52804d7 (patch) | |
tree | 0744d421207bdd66d743fcbb87e0d9cf11739cf8 /test | |
parent | e70d52b0c377f8b2ed04311710c0ca9f4ebabd90 (diff) | |
download | ruby-d07a6dc10efa71123b36a4a3ff7d2ec6e52804d7.tar.gz |
delegate.rb: fixed keyword arguments in DelegateClass
`Delegator.delegating_block` should delegate keyword arguments
separately. [ruby-core:96949]
(cherry picked from commit 9bcf4f3db26249772c983896ebbc9ff41f4614db)
Diffstat (limited to 'test')
-rw-r--r-- | test/test_delegate.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_delegate.rb b/test/test_delegate.rb index 02a343358f..5660adc590 100644 --- a/test/test_delegate.rb +++ b/test/test_delegate.rb @@ -330,4 +330,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 |