Improved test_stub_callable_keyword_args to test pass-through.

[git-p4: depot-paths = "//src/minitest/dev/": change = 13022]
This commit is contained in:
Ryan Davis 2021-02-14 22:20:14 -08:00
parent 8a7ba8191f
commit 13c48a03d8
2 changed files with 5 additions and 3 deletions

View File

@ -207,7 +207,9 @@ class Object
# assert obj_under_test.stale?
# end
# end
#
#--
# NOTE: keyword args in callables are NOT checked for correctness
# against the existing method. Too many edge cases to be worth it.
def stub name, val_or_callable, *block_args
new_name = "__minitest_stub__#{name}"

View File

@ -598,8 +598,8 @@ class TestMinitestStub < Minitest::Test
end
def test_stub_callable_keyword_args
Keywords.stub :args, ->(*args, **kws) { 42 } do
@tc.assert_equal 42, Keywords.args("woot", kw1:314)
Keywords.stub :args, ->(*args, **kws) { [args, kws] } do
@tc.assert_equal [["woot"], { kw1: 42 }], Keywords.args("woot", kw1: 42)
end
end