Skip to content

Commit 9a086f8

Browse files
committed
Document using matchers and custom matchers. Closes #15.
1 parent 126c5eb commit 9a086f8

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,36 @@ f:should_be_called_with(1):
150150
end)
151151
```
152152

153+
## Match Arguments Using Deep Compare
154+
155+
```lua
156+
local mach = require 'mach'
157+
158+
local f = mach.mockFunction();
159+
160+
f:should_be_called_with(mach.match({ 1, 2, 3 })):
161+
when(function()
162+
f({ 1, 2, 3 })
163+
end)
164+
```
165+
166+
## Match Arguments Using Custom Matcher
167+
168+
```lua
169+
local mach = require 'mach'
170+
171+
local custom_matcher = function(a, b)
172+
return a == b
173+
end
174+
175+
local f = mach.mockFunction();
176+
177+
f:should_be_called_with(mach.match({ 1, 2, 3 }, custom_matcher)):
178+
when(function()
179+
f({ 1, 2, 3 })
180+
end)
181+
```
182+
153183
## Ignoring Other calls
154184

155185
```javascript

0 commit comments

Comments
 (0)