Skip to content

Commit 44e3fe6

Browse files
add func mock test, fix func mock, interface mock
1 parent f91b88c commit 44e3fe6

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

CodeGeneratorTests/funcMock.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
testSuccessHandlerDidReturn = successHandler(testSuccessHandlerParam0, testSuccessHandlerParam1)
44
}
55
testFuncMockWasCalled = true
6+
testFuncMockWasCalledTimes += 1
67
return testFuncMockShouldReturn

Generate.../FuncMocker.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ struct FuncMocker {
4545
var bodyLines = paramMockers.flatMap { $0.lines }
4646
let wasCalledBodyLine = "\(indentation)\(indentation)\(wasCalledVariable.name) = true"
4747
bodyLines.append(wasCalledBodyLine)
48+
let wasCalledTimesBodyLine = "\(indentation)\(indentation)\(wasCalledTimesVariable.name) += 1"
49+
bodyLines.append(wasCalledTimesBodyLine)
4850
if let returnVariable = returnVariable {
4951
let returnLine = "\(indentation)\(indentation)return \(returnVariable.name)"
5052
bodyLines.append(returnLine)

0 commit comments

Comments
 (0)