@@ -6,7 +6,7 @@ Simple mocking framework for Lua inspired by CppUMock and designed for readabili
6
6
## Mocking a Function
7
7
8
8
``` lua
9
- mach = require ' mach'
9
+ local mach = require ' mach'
10
10
11
11
local f = mach .mock_function ()
12
12
@@ -16,7 +16,7 @@ f:should_be_called():when(function() f() end)
16
16
## Mocking a Method
17
17
18
18
``` lua
19
- mach = require ' mach'
19
+ local mach = require ' mach'
20
20
21
21
local o = {}
22
22
o .m = mach .mach_method ()
@@ -27,7 +27,7 @@ m:should_be_called():when(function() o:m() end)
27
27
## Mocking a Table
28
28
29
29
``` lua
30
- mach = require ' mach'
30
+ local mach = require ' mach'
31
31
32
32
local some_table = {
33
33
foo = function () end ,
44
44
## Mocking an Object
45
45
46
46
``` lua
47
- mach = require ' mach'
47
+ local mach = require ' mach'
48
48
49
49
local some_object = {}
50
50
function some_object :foo () end
60
60
## Multiple Expectations
61
61
62
62
``` lua
63
- mach = require ' mach'
63
+ local mach = require ' mach'
64
64
65
65
local f1 = mach .mock_function ()
66
66
local f2 = mach .mock_function ()
@@ -76,7 +76,7 @@ f1:should_be_called():
76
76
## Optional Expectations
77
77
78
78
``` lua
79
- mach = require ' mach'
79
+ local mach = require ' mach'
80
80
81
81
local f = mach .mock_function ()
82
82
@@ -86,7 +86,7 @@ f:mayBeCalled():when(function() end)
86
86
## Optional Ordering
87
87
88
88
``` lua
89
- mach = require ' mach'
89
+ local mach = require ' mach'
90
90
91
91
local f = mach .mock_function ()
92
92
@@ -110,7 +110,7 @@ f:should_be_called_with(1):
110
110
## Mixed Ordering
111
111
112
112
``` lua
113
- mach = require ' mach'
113
+ local mach = require ' mach'
114
114
115
115
local f = mach .mock_function ()
116
116
@@ -129,7 +129,7 @@ f:should_be_called_with(1):
129
129
## Flexible Syntax
130
130
131
131
``` lua
132
- mach = require ' mach'
132
+ local mach = require ' mach'
133
133
134
134
local m1 = mach .mock_function ()
135
135
local m2 = mach .mock_function ()
0 commit comments