diff options
author | nagachika <nagachika@ruby-lang.org> | 2021-02-20 18:46:40 +0900 |
---|---|---|
committer | nagachika <nagachika@ruby-lang.org> | 2021-02-20 18:46:40 +0900 |
commit | 931815bfd86df603337194f3fcefb46bfe3e7940 (patch) | |
tree | 88cada33acfc5f71947c0b54ef6f8b4da5a358fd /test | |
parent | 0cfd491732162eab61227ac4b49617c37ddbb316 (diff) |
merge revision(s) eeacdcb9a073c7d8ad703e0dc9faf229a5ebbe3c: [Backport #17558]
Fixed premature return
After setting ruby2_keywords for bmethod, the rest of arguments
had been ignored. [Bug #17558]
---
test/ruby/test_keyword.rb | 9 +++++++++
vm_method.c | 2 +-
2 files changed, 10 insertions(+), 1 deletion(-)
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_keyword.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index e9be530754..ab3c11e149 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -2741,6 +2741,11 @@ class TestKeywordArguments < Test::Unit::TestCase baz(*args) end + define_method(:block_splat) {|*args| } + ruby2_keywords :block_splat, def foo_bar_after_bmethod(*args) + bar(*args) + end + ruby2_keywords def foo_baz2(*args) baz(*args) baz(*args) @@ -2876,6 +2881,7 @@ class TestKeywordArguments < Test::Unit::TestCase assert_equal([1, h1], o.foo(:foo_baz, 1, :a=>1)) assert_equal([[1], h1], o.foo_foo_bar(1, :a=>1)) assert_equal([1, h1], o.foo_foo_baz(1, :a=>1)) + assert_equal([[1], h1], o.foo_bar_after_bmethod(1, :a=>1)) assert_equal([[1], h1], o.foo(:bar, 1, **h1)) assert_equal([1, h1], o.foo(:baz, 1, **h1)) @@ -2891,6 +2897,7 @@ class TestKeywordArguments < Test::Unit::TestCase assert_equal([1, h1], o.foo(:foo_baz, 1, **h1)) assert_equal([[1], h1], o.foo_foo_bar(1, **h1)) assert_equal([1, h1], o.foo_foo_baz(1, **h1)) + assert_equal([[1], h1], o.foo_bar_after_bmethod(1, **h1)) assert_equal([[h1], {}], o.foo(:bar, h1, **{})) assert_equal([h1], o.foo(:baz, h1, **{})) @@ -2906,6 +2913,7 @@ class TestKeywordArguments < Test::Unit::TestCase assert_equal([h1], o.foo(:foo_baz, h1, **{})) assert_equal([[h1], {}], o.foo_foo_bar(h1, **{})) assert_equal([h1], o.foo_foo_baz(h1, **{})) + assert_equal([[h1], {}], o.foo_bar_after_bmethod(h1, **{})) assert_warn(/Using the last argument as keyword parameters is deprecated.*The called method `bar'/m) do assert_equal([[1], h1], o.foo(:bar, 1, h1)) @@ -2923,6 +2931,7 @@ class TestKeywordArguments < Test::Unit::TestCase assert_equal([[1], h1], o.foo_bar(1, h1)) end assert_equal([1, h1], o.foo_baz(1, h1)) + assert_equal([[1], h1], o.foo_bar_after_bmethod(1, h1)) assert_equal([[1, h1, 1], {}], o.foo_mod(:bar, 1, :a=>1)) assert_equal([1, h1, 1], o.foo_mod(:baz, 1, :a=>1)) |