local test = spy.new(function() end)
test('this', 39)
assert.spy(test).called_with('that', match._)
Implementation:
Thought about using a custom formatter for the _ matcher, but the order that the formatter is added to the list would be critical (it would have to be added after assert:add_formatter(fmt_matcher) in formatters/init.lua so it would be evaluated before fmt_matcher). And it would be another formatter to cycle thru for all arguments formatted. Plus it is a matcher after all and there already is a fmt_matcher
Considered naming it anything and defining it like all the regular matchers. But the regular matchers are intended to be called (e.g. assert.spy(s).was.called_with(match.is_number())) whereas match._ as shown in the README is not. Plus it looks more like natural lua when used as is.
Ultimately decided on a small change to fmt_matcher and a couple additional fields on match._ to make pass thru fmt_matcher without error.
Formatting:
I chose to display it in the assertion messages as _ *anything* since _ alone might confuse someone reading test results who hasn't used that matcher before.
Fixes #179
Cause the issue with:
Implementation:
_
matcher, but the order that the formatter is added to the list would be critical (it would have to be added afterassert:add_formatter(fmt_matcher)
in formatters/init.lua so it would be evaluated before fmt_matcher). And it would be another formatter to cycle thru for all arguments formatted. Plus it is amatcher
after all and there already is afmt_matcher
anything
and defining it like all the regular matchers. But the regular matchers are intended to be called (e.g.assert.spy(s).was.called_with(match.is_number())
) whereas match._ as shown in the README is not. Plus it looks more like natural lua when used as is.fmt_matcher
and a couple additional fields on match._ to make pass thru fmt_matcher without error.Formatting:
_ *anything*
since_
alone might confuse someone reading test results who hasn't used that matcher before.