summaryrefslogtreecommitdiff
path: root/test/ruby/test_keyword.rb
diff options
context:
space:
mode:
authorNARUSE, Yui <naruse@airemix.jp>2021-02-02 00:14:24 +0900
committerNARUSE, Yui <naruse@airemix.jp>2021-02-02 15:47:50 +0900
commit7899046315321f78fa95ef92f313afa86f4d962b (patch)
treeaf7813f067f7360648d717c3107665e3d3019986 /test/ruby/test_keyword.rb
parent1d1f07cea04843677877b477fa61b1712d1f0a5c (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/ruby/test_keyword.rb')
-rw-r--r--test/ruby/test_keyword.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb
index 8ec0636d5c..03f539fc72 100644
--- a/test/ruby/test_keyword.rb
+++ b/test/ruby/test_keyword.rb
@@ -2366,6 +2366,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)
@@ -2501,6 +2506,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))
@@ -2516,6 +2522,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, **{}))
@@ -2531,6 +2538,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_equal([[1, h1], {}], o.foo(:bar, 1, h1))
assert_equal([1, h1], o.foo(:baz, 1, h1))
@@ -2540,6 +2548,7 @@ class TestKeywordArguments < Test::Unit::TestCase
assert_equal([1, h1], o.store_foo(:baz, 1, h1))
assert_equal([[1, h1], {}], o.foo_bar(1, h1))
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))