We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 8c9e761 + cec6c0c commit 8b34ac9Copy full SHA for 8b34ac9
Sources/SwiftyMocky/ArgumentCaptor.swift
@@ -9,8 +9,15 @@ public class ArgumentCaptor<Type> {
9
public init() {}
10
11
/// Return parameter matcher which captures the argument.
12
- public func capture() -> Parameter<Type> {
+ public func capture(where matches: ((Type) -> Bool)? = nil) -> Parameter<Type> {
13
return .matching({ (value: Type) -> Bool in
14
+ if let matchFunction = matches {
15
+ let match = matchFunction(value)
16
+ if match {
17
+ self.allValues.append(value)
18
+ }
19
+ return match
20
21
self.allValues.append(value)
22
return true
23
})
0 commit comments