Skip to content

Commit a514037

Browse files
committed
Print <mach.any> for an argument that can match anything. Relates to #19.
1 parent 65843df commit a514037

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

spec/mach_spec.lua

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -608,8 +608,8 @@ describe('The mach library', function()
608608

609609
should_fail_with_exactly(expected_failure, function()
610610
o.m:should_be_called():when(function()
611-
f()
612-
end)
611+
f()
612+
end)
613613
end)
614614
end)
615615

@@ -679,7 +679,12 @@ describe('The mach library', function()
679679
end)
680680

681681
it('should match other arguments when mach.any is used for an argument', function()
682-
should_fail(function()
682+
local expected_failure =
683+
'Unexpected arguments (false, 2, 4) provided to function f\n' ..
684+
'Incomplete calls:\n' ..
685+
'\tf(<mach.any>, 2, 3)'
686+
687+
should_fail_with_exactly(expected_failure, function()
683688
f:should_be_called_with(mach.any, 2, 3):when(function()
684689
f(false, 2, 4)
685690
end)

src/mach/any.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
return {}
1+
return setmetatable({}, {
2+
__tostring = function() return '<mach.any>' end
3+
})

0 commit comments

Comments
 (0)