Parameter
public enum Parameter<ValueType>
Parameter wraps method attribute, allowing to make a difference between explicit value,
expressed by .value
case and wildcard value, expressed by .any
case.
Whole idea is to be able to test and specify behaviours, in both generic and explicit way (and any mix of these two). Every test method matches mock methods in signature, but changes attributes types to Parameter.
That allows pattern like matching between two Parameter values:
- .any is equal to every other parameter. (!!! actual case name is
._
, but it is advised to use.any
) - .value(p1) is equal to .value(p2) only, when p1 == p2
Important! Comparing parameters, where ValueType is not Equatable will result in fatalError, unless you register comparator for its ValueType in Matcher instance used (typically Matcher.default)
- any: represents and matches any parameter value
- value: represents explicit parameter value
-
Wildcard - any value
Declaration
Swift
case `_`
-
Explicit value
Declaration
Swift
case value(ValueType)
-
Any value matching
Declaration
Swift
case matching((ValueType) -> Bool)
-
Represents and matches any parameter value - syntactic sugar for
._
case.Declaration
Swift
public static var any: Parameter<ValueType> { get }
-
Represents and matches any parameter value - syntactic sugar for
._
case. Used, when needs to explicitely specify wrapped ValueType type, to resolve ambiguity between methods with same signatures, but different attribute types.Parameters
type
Explicitly specify ValueType type
Return Value
any parameter
-
Undocumented
Declaration
Swift
public var shortDescription: String { get }
-
Represents and matches values on an
same instance
basis.Declaration
Swift
static func sameInstance<T>(as instance: T) -> Parameter<ValueType> where T : AnyObject
Parameters
instance
Instance to match against
-
Represents and matches whether parameter is of specific type, using
is
operator.Declaration
Swift
static func isInstance<T>(of type: T.Type) -> Parameter<ValueType> where T : AnyObject
Parameters
type
Type to match against
-
Allows combining multiple Parameter constraints into one Parameter constraint.
Declaration
Swift
static func all(_ matching: Parameter<ValueType>...) -> Parameter<ValueType>
Parameters
matching
List of parameter constraints
-
Used for invocations sorting purpose.
Declaration
Swift
var intValue: Int { get }
-
Used for invocations sorting purpose.
Declaration
Swift
var intValue: Int { get }
-
Declaration
Swift
public typealias StringLiteralType = ValueType.StringLiteralType
-
Declaration
Swift
public typealias ExtendedGraphemeClusterLiteralType = ValueType.ExtendedGraphemeClusterLiteralType
-
Declaration
Swift
public typealias UnicodeScalarLiteralType = ValueType.UnicodeScalarLiteralType
-
Declaration
Swift
public init(stringLiteral value: StringLiteralType)
-
Declaration
Swift
public init(extendedGraphemeClusterLiteral value: ExtendedGraphemeClusterLiteralType)
-
Declaration
Swift
public init(unicodeScalarLiteral value: UnicodeScalarLiteralType)
-
Declaration
Swift
public init(nilLiteral: ())
-
Declaration
Swift
public typealias IntegerLiteralType = ValueType.IntegerLiteralType
-
Declaration
Swift
public init(integerLiteral value: ValueType.IntegerLiteralType)
-
Declaration
Swift
public typealias BooleanLiteralType = ValueType.BooleanLiteralType
-
Declaration
Swift
public init(booleanLiteral value: BooleanLiteralType)
-
Declaration
Swift
public typealias FloatLiteralType = ValueType.FloatLiteralType
-
Declaration
Swift
public init(floatLiteral value: FloatLiteralType)
-
Declaration
Swift
public typealias ArrayLiteralElement = ValueType.ArrayLiteralElement
-
Declaration
Swift
public init(arrayLiteral elements: ArrayLiteralElement...)
-
Declaration
Swift
public typealias Key = ValueType.Key
-
Declaration
Swift
public typealias Value = ValueType.Value