@@ -10,7 +10,7 @@ mach = require 'mach'
10
10
11
11
local f = mach .mock_function ()
12
12
13
- mach ( f ) :should_be_called ():
13
+ f :should_be_called ():
14
14
when (function () f () end )
15
15
```
16
16
@@ -22,7 +22,7 @@ mach = require 'mach'
22
22
local o = {}
23
23
o .m = mach .mach_method ()
24
24
25
- mach ( m ) :should_be_called ():
25
+ m :should_be_called ():
26
26
when (function () o :m () end )
27
27
```
28
28
@@ -38,7 +38,7 @@ local some_table = {
38
38
39
39
mocked_table = mach .mockTable (some_table )
40
40
41
- mach ( mocked_table .foo ) :should_be_called ():
41
+ mocked_table .foo :should_be_called ():
42
42
when (function () mocked_table .foo () end )
43
43
```
44
44
@@ -53,7 +53,7 @@ function some_object:bar() end
53
53
54
54
mocked_object = mach .mock_object (some_object )
55
55
56
- mach ( mocked_object .foo ) :should_be_called ():
56
+ mocked_object .foo :should_be_called ():
57
57
when (function () mocked_object :foo () end )
58
58
```
59
59
@@ -65,8 +65,8 @@ mach = require 'mach'
65
65
local f1 = mach .mock_function ()
66
66
local f2 = mach .mock_function ()
67
67
68
- mach ( f1 ) :should_be_called ():
69
- and_also (mach ( f2 ) :should_be_called ()):
68
+ f1 :should_be_called ():
69
+ and_also (f2 :should_be_called ()):
70
70
when (function () f1 (); f2 () end )
71
71
```
72
72
@@ -77,7 +77,7 @@ mach = require 'mach'
77
77
78
78
local f = mach .mock_function ()
79
79
80
- mach ( f ) :mayBeCalled ():
80
+ f :mayBeCalled ():
81
81
when (function () end )
82
82
```
83
83
@@ -89,16 +89,16 @@ mach = require 'mach'
89
89
local f = mach .mock_function ()
90
90
91
91
-- Use and_also when order is important
92
- mach ( f ): should_be_calledWith (1 ):
93
- andThen (mach ( f ): should_be_calledWith (2 )):
92
+ f : should_be_called_with (1 ):
93
+ andThen (f : should_be_called_with (2 )):
94
94
when (function ()
95
95
f (2 ) -- Error, out of order call
96
96
f (1 )
97
97
end )
98
98
99
99
-- Use and_also when order is unimportant
100
- mach ( f ): should_be_calledWith (1 ):
101
- and_also (mach ( f ): should_be_calledWith (2 )):
100
+ f : should_be_called_with (1 ):
101
+ and_also (f : should_be_called_with (2 )):
102
102
when (function ()
103
103
f (2 ) -- No error, order is not fixed when 'and_also' is used
104
104
f (1 )
@@ -112,10 +112,10 @@ mach = require 'mach'
112
112
113
113
local f = mach .mock_function ()
114
114
115
- mach ( f ): should_be_calledWith (1 ):
116
- and_also (mach ( f ): should_be_calledWith (2 )):
117
- andThen (mach ( f ): should_be_calledWith (3 )):
118
- and_also (mach ( f ): should_be_calledWith (4 )):
115
+ f : should_be_called_with (1 ):
116
+ and_also (f : should_be_called_with (2 )):
117
+ andThen (f : should_be_called_with (3 )):
118
+ and_also (f : should_be_called_with (4 )):
119
119
when (function ()
120
120
f (2 )
121
121
f (1 )
@@ -133,11 +133,11 @@ local m1 = mach.mock_function()
133
133
local m2 = mach .mock_function ()
134
134
135
135
function something_should_happen ()
136
- return mach ( m1 ) :should_be_called ()
136
+ return m1 :should_be_called ()
137
137
end
138
138
139
139
function another_thing_should_happen ()
140
- return mach ( m2 ): should_be_calledWith (1 , 2 , 3 )
140
+ return m2 : should_be_called_with (1 , 2 , 3 )
141
141
end
142
142
143
143
function the_code_under_test_runs ()
0 commit comments