Skip to content

Commit e2ac10e

Browse files
committed
Add example for specifying return values
1 parent 3c2c6d2 commit e2ac10e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,19 @@ mocked_object.foo:should_be_called():when(function()
5757
end)
5858
```
5959

60-
## Raising Errors with Mocks
60+
## Returning Values
61+
62+
```lua
63+
local mach = require 'mach'
64+
65+
local f = mach.mock_function('f')
66+
67+
f:should_be_called():and_will_return(1, 4):when(function()
68+
local x, y = f()
69+
end)
70+
```
71+
72+
## Raising Errors
6173

6274
```lua
6375
local mach = require 'mach'

0 commit comments

Comments
 (0)