Skip to content

Commit 7325769

Browse files
committed
Added alias for and_other_calls_should_be_ignored to improve readability
1 parent 1839c6d commit 7325769

File tree

5 files changed

+52
-2
lines changed

5 files changed

+52
-2
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,18 @@ local mach = require 'mach'
210210

211211
local f = mach.mock_function('f')
212212

213-
f:should_be_called().and_other_calls_should_be_ignored():when(function()
213+
f:should_be_called():and_other_calls_should_be_ignored():when(function()
214+
f()
215+
f(1)
216+
end)
217+
```
218+
219+
```javascript
220+
local mach = require 'mach'
221+
222+
local f = mach.mock_function('f')
223+
224+
f:should_be_called():with_other_calls_ignored():when(function()
214225
f()
215226
f(1)
216227
end)

publish-to-lit.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ local f = io.open('build/mach.lua', 'w')
55
f:write([==[
66
--[[lit-meta
77
name = 'ryanplusplus/mach'
8-
version = '1.0.5'
8+
version = '1.0.8'
99
description = 'Simple mocking framework for Lua inspired by CppUMock and designed for readability.'
1010
tags = { 'testing' }
1111
license = 'MIT'

rockspecs/mach-4.5-0.rockspec

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package = 'mach'
2+
version = '4.5-0'
3+
source = {
4+
url = 'https://github.com/ryanplusplus/mach.lua/archive/v4.5-0.tar.gz',
5+
dir = 'mach.lua-4.5-0/src'
6+
}
7+
description = {
8+
summary = 'Simple mocking framework for Lua inspired by CppUMock and designed for readability.',
9+
homepage = 'https://github.com/ryanplusplus/mach.lua/',
10+
license = 'MIT <http://opensource.org/licenses/MIT>'
11+
}
12+
dependencies = {
13+
'lua >= 5.1'
14+
}
15+
build = {
16+
type = 'builtin',
17+
modules = {
18+
['mach'] = 'mach.lua',
19+
['mach.Expectation'] = 'mach/Expectation.lua',
20+
['mach.ExpectedCall'] = 'mach/ExpectedCall.lua',
21+
['mach.CompletedCall'] = 'mach/CompletedCall.lua',
22+
['mach.unexpected_call_error'] = 'mach/unexpected_call_error.lua',
23+
['mach.unexpected_args_error'] = 'mach/unexpected_args_error.lua',
24+
['mach.out_of_order_call_error'] = 'mach/out_of_order_call_error.lua',
25+
['mach.not_all_calls_occurred_error'] ='mach/not_all_calls_occurred_error.lua',
26+
['mach.format_call_status'] = 'mach/format_call_status.lua',
27+
['mach.format_arguments'] = 'mach/format_arguments.lua',
28+
['mach.deep_compare_matcher'] = 'mach/deep_compare_matcher.lua',
29+
['mach.match'] = 'mach/match.lua',
30+
['mach.any'] = 'mach/any.lua',
31+
}
32+
}

spec/mach_spec.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,11 @@ describe('The mach library', function()
515515
f1()
516516
f2()
517517
end)
518+
519+
f1:should_be_called():with_other_calls_ignored():when(function()
520+
f1()
521+
f2()
522+
end)
518523
end)
519524

520525
it('should report completed and incomplete calls in unexpected call errors', function()

src/mach/Expectation.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,6 @@ function expectation:and_other_calls_should_be_ignored()
197197
return self
198198
end
199199

200+
expectation.with_other_calls_ignored = expectation.and_other_calls_should_be_ignored
201+
200202
return create

0 commit comments

Comments
 (0)