Contents

matches(_:requirement:)

Creates an expectation that requires the value to satisfy a predicate, with an optional description of the check.

Declaration

static func matches<Input>(_ predicate: Predicate<Input>, requirement: String? = nil) -> PredicateExpectation where Input : IntentValueConvertible

Parameters

  • predicate:

    The predicate to evaluate against the value.

  • requirement:

    A readable description of the check. The default is nil.

Return Value

A predicate expectation that evaluates predicate against the value.

Discussion

Use this method for values that aren’t strings. A predicate on a non-optional type isn’t satisfied when the value is missing, and a predicate on an optional type receives nil and decides for itself. A predicate whose input type doesn’t match the value’s type isn’t satisfied.