summaryrefslogtreecommitdiff
path: root/test/-ext-/funcall
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-10-04 15:41:13 -0700
committerJeremy Evans <code@jeremyevans.net>2020-01-02 18:40:45 -0800
commitff96565686c05919bcae3ea77831879e95f67457 (patch)
treee04eaa5afdaaa942ccfef86648ebfb8a632e8c33 /test/-ext-/funcall
parentbeae6cbf0fd8b6619e5212552de98022d4c4d4d4 (diff)
Update tests for full keyword argument separation
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2794
Diffstat (limited to 'test/-ext-/funcall')
-rw-r--r--test/-ext-/funcall/test_passing_block.rb23
1 files changed, 4 insertions, 19 deletions
diff --git a/test/-ext-/funcall/test_passing_block.rb b/test/-ext-/funcall/test_passing_block.rb
index d1164871b0..71c9d905be 100644
--- a/test/-ext-/funcall/test_passing_block.rb
+++ b/test/-ext-/funcall/test_passing_block.rb
@@ -24,14 +24,10 @@ class TestFuncall < Test::Unit::TestCase
def test_with_funcall_passing_block_kw
block = ->(*a, **kw) { [a, kw] }
assert_equal([[1], {}], Relay.with_funcall_passing_block_kw(0, 1, &block))
+ assert_equal([[{a: 1}], {}], Relay.with_funcall_passing_block_kw(0, a: 1, &block))
assert_equal([[], {a: 1}], Relay.with_funcall_passing_block_kw(1, a: 1, &block))
assert_equal([[1], {a: 1}], Relay.with_funcall_passing_block_kw(1, 1, a: 1, &block))
- assert_equal([[{}], {}], Relay.with_funcall_passing_block_kw(2, {}, **{}, &block))
assert_equal([[], {a: 1}], Relay.with_funcall_passing_block_kw(3, a: 1, &block))
- assert_equal([[{a: 1}], {}], Relay.with_funcall_passing_block_kw(3, {a: 1}, **{}, &block))
- assert_warn(/warning: Passing the keyword argument as the last hash parameter is deprecated.*The called method is defined here/m) do
- assert_equal({}, Relay.with_funcall_passing_block_kw(3, **{}, &->(a){a}))
- end
end
def test_with_funcallv_public_kw
@@ -47,29 +43,18 @@ class TestFuncall < Test::Unit::TestCase
arg
end
assert_equal([[1], {}], Relay.with_funcallv_public_kw(o, :foo, 0, 1))
+ assert_equal([[{a: 1}], {}], Relay.with_funcallv_public_kw(o, :foo, 0, a: 1))
assert_equal([[], {a: 1}], Relay.with_funcallv_public_kw(o, :foo, 1, a: 1))
assert_equal([[1], {a: 1}], Relay.with_funcallv_public_kw(o, :foo, 1, 1, a: 1))
- assert_equal([[{}], {}], Relay.with_funcallv_public_kw(o, :foo, 2, {}, **{}))
assert_equal([[], {a: 1}], Relay.with_funcallv_public_kw(o, :foo, 3, a: 1))
- assert_equal([[{a: 1}], {}], Relay.with_funcallv_public_kw(o, :foo, 3, {a: 1}, **{}))
- assert_raise(NoMethodError) { Relay.with_funcallv_public_kw(o, :bar, 3, {a: 1}, **{}) }
- assert_warn(/warning: Passing the keyword argument as the last hash parameter is deprecated.*The called method `baz'/m) do
- assert_equal({}, Relay.with_funcallv_public_kw(o, :baz, 3, **{}))
- end
end
def test_with_yield_splat_kw
block = ->(*a, **kw) { [a, kw] }
assert_equal([[1], {}], Relay.with_yield_splat_kw(0, [1], &block))
+ assert_equal([[{a: 1}], {}], Relay.with_yield_splat_kw(0, [{a: 1}], &block))
assert_equal([[], {a: 1}], Relay.with_yield_splat_kw(1, [{a: 1}], &block))
assert_equal([[1], {a: 1}], Relay.with_yield_splat_kw(1, [1, {a: 1}], &block))
- assert_equal([[{}], {}], Relay.with_yield_splat_kw(2, [{}], **{}, &block))
- assert_warn(/warning: Using the last argument as keyword parameters is deprecated.*The called method is defined here/m) do
- assert_equal([[], {a: 1}], Relay.with_yield_splat_kw(3, [{a: 1}], &block))
- end
- assert_equal([[{a: 1}], {}], Relay.with_yield_splat_kw(3, [{a: 1}], **{}, &block))
- assert_warn(/warning: Passing the keyword argument as the last hash parameter is deprecated/) do
- assert_equal({}, Relay.with_yield_splat_kw(3, [], **{}, &->(a){a}))
- end
+ assert_equal([[], {a: 1}], Relay.with_yield_splat_kw(3, [{a: 1}], &block))
end
end