Created
August 6, 2021 09:06
-
-
Save frootloops/72124c8735b2b7edaedea786c34dc3f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public struct MockFunc<Input, Output> { | |
public var parameters: [Input] = [] | |
public var result: (Input) -> Output = { _ in fatalError() } | |
public mutating func callAndReturn(_ input: Input) -> Output { | |
parameters.append(input) | |
return result(input) | |
} | |
public mutating func returns(_ value: Output) { | |
result = { _ in value } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment