SyncExpectation

public struct SyncExpectation<Value> : Expectation

Undocumented

  • Undocumented

    Declaration

    Swift

    public let expression: Expression<Value>
  • The status of the test after predicates have been evaluated.

    This property can be used for changing test behavior based whether an expectation has passed.

    In the below example, we perform additional tests on an array only if it has enough elements.

    if expect(array).to(haveCount(10)).status == .passed {
       expect(array[9]).to(...)
    }
    

    Remark

    Similar functionality can be achieved using the onFailure(throw:) method.

    Declaration

    Swift

    public let status: ExpectationStatus
  • Undocumented

    Declaration

    Swift

    public init(expression: Expression<Value>)
  • Takes the result of a test and passes it to the assertion handler.

    Declaration

    Swift

    @discardableResult
    public func verify(_ pass: Bool, _ message: FailureMessage) -> SyncExpectation<Value>

    Return Value

    An updated Expression with the result of the test applied to the status property.

  • Undocumented

    Declaration

    Swift

    public static func == (lhs: SyncExpectation, rhs: ExpectationNil)
  • Undocumented

    Declaration

    Swift

    public static func != (lhs: SyncExpectation, rhs: ExpectationNil)
  • Tests the actual value using a matcher to match by checking continuously at each pollInterval until the timeout is reached.

    Declaration

    Swift

    @discardableResult
    public func toEventually(_ predicate: Predicate<Value>, timeout: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) async -> SyncExpectation<Value>
  • Tests the actual value using a matcher to not match by checking continuously at each pollInterval until the timeout is reached.

    Declaration

    Swift

    @discardableResult
    public func toEventuallyNot(_ predicate: Predicate<Value>, timeout: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) async -> SyncExpectation<Value>
  • Tests the actual value using a matcher to not match by checking continuously at each pollInterval until the timeout is reached.

    Alias of toEventuallyNot()

    Declaration

    Swift

    @discardableResult
    public func toNotEventually(_ predicate: Predicate<Value>, timeout: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) async -> SyncExpectation<Value>
  • Tests the actual value using a matcher to never match by checking continuously at each pollInterval until the timeout is reached.

    Declaration

    Swift

    @discardableResult
    public func toNever(_ predicate: Predicate<Value>, until: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) async -> SyncExpectation<Value>
  • Tests the actual value using a matcher to never match by checking continuously at each pollInterval until the timeout is reached.

    Alias of toNever()

    Declaration

    Swift

    @discardableResult
    public func neverTo(_ predicate: Predicate<Value>, until: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) async -> SyncExpectation<Value>
  • Tests the actual value using a matcher to always match by checking continusouly at each pollInterval until the timeout is reached

    Declaration

    Swift

    @discardableResult
    public func toAlways(_ predicate: Predicate<Value>, until: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) async -> SyncExpectation<Value>
  • Tests the actual value using a matcher to always match by checking continusouly at each pollInterval until the timeout is reached

    Alias of toAlways()

    Declaration

    Swift

    @discardableResult
    public func alwaysTo(_ predicate: Predicate<Value>, until: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) async -> SyncExpectation<Value>
  • Tests the actual value using a matcher to match by checking continuously at each pollInterval until the timeout is reached.

    @discussion This function manages the main run loop (NSRunLoop.mainRunLoop()) while this function is executing. Any attempts to touch the run loop may cause non-deterministic behavior.

    @warning This form of toEventually does not work in any kind of async context. Use the async form of toEventually if you are running tests in an async context.

    Declaration

    Swift

    @available(*, noasync, message: "the sync version of `toEventually` does not work in async contexts. Use the async version with the same name as a drop-in replacement")
    @discardableResult
    public func toEventually(_ predicate: Predicate<Value>, timeout: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) -> SyncExpectation<Value>
  • Tests the actual value using a matcher to not match by checking continuously at each pollInterval until the timeout is reached.

    @discussion This function manages the main run loop (NSRunLoop.mainRunLoop()) while this function is executing. Any attempts to touch the run loop may cause non-deterministic behavior.

    @warning This form of toEventuallyNot does not work in any kind of async context. Use the async form of toEventuallyNot if you are running tests in an async context.

    Declaration

    Swift

    @available(*, noasync, message: "the sync version of `toEventuallyNot` does not work in async contexts. Use the async version with the same name as a drop-in replacement")
    @discardableResult
    public func toEventuallyNot(_ predicate: Predicate<Value>, timeout: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) -> SyncExpectation<Value>
  • Tests the actual value using a matcher to not match by checking continuously at each pollInterval until the timeout is reached.

    Alias of toEventuallyNot()

    @discussion This function manages the main run loop (NSRunLoop.mainRunLoop()) while this function is executing. Any attempts to touch the run loop may cause non-deterministic behavior.

    @warning This form of toNotEventually does not work in any kind of async context. Use the async form of toNotEventually if you are running tests in an async context.

    Declaration

    Swift

    @available(*, noasync, message: "the sync version of `toNotEventually` does not work in async contexts. Use the async version with the same name as a drop-in replacement")
    @discardableResult
    public func toNotEventually(_ predicate: Predicate<Value>, timeout: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) -> SyncExpectation<Value>
  • Tests the actual value using a matcher to never match by checking continuously at each pollInterval until the timeout is reached.

    @discussion This function manages the main run loop (NSRunLoop.mainRunLoop()) while this function is executing. Any attempts to touch the run loop may cause non-deterministic behavior.

    @warning This form of toNever does not work in any kind of async context. Use the async form of toNever if you are running tests in an async context.

    Declaration

    Swift

    @available(*, noasync, message: "the sync version of `toNever` does not work in async contexts. Use the async version with the same name as a drop-in replacement")
    @discardableResult
    public func toNever(_ predicate: Predicate<Value>, until: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) -> SyncExpectation<Value>
  • Tests the actual value using a matcher to never match by checking continuously at each pollInterval until the timeout is reached.

    Alias of toNever()

    @discussion This function manages the main run loop (NSRunLoop.mainRunLoop()) while this function is executing. Any attempts to touch the run loop may cause non-deterministic behavior.

    @warning This form of neverTo does not work in any kind of async context. Use the async form of neverTo if you are running tests in an async context.

    Declaration

    Swift

    @available(*, noasync, message: "the sync version of `neverTo` does not work in async contexts. Use the async version with the same name as a drop-in replacement")
    @discardableResult
    public func neverTo(_ predicate: Predicate<Value>, until: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) -> SyncExpectation<Value>
  • Tests the actual value using a matcher to always match by checking continusouly at each pollInterval until the timeout is reached

    @discussion This function manages the main run loop (NSRunLoop.mainRunLoop()) while this function is executing. Any attempts to touch the run loop may cause non-deterministic behavior.

    @warning This form of toAlways does not work in any kind of async context. Use the async form of toAlways if you are running tests in an async context.

    Declaration

    Swift

    @available(*, noasync, message: "the sync version of `toAlways` does not work in async contexts. Use the async version with the same name as a drop-in replacement")
    @discardableResult
    public func toAlways(_ predicate: Predicate<Value>, until: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) -> SyncExpectation<Value>
  • Tests the actual value using a matcher to always match by checking continusouly at each pollInterval until the timeout is reached

    Alias of toAlways()

    @discussion This function manages the main run loop (NSRunLoop.mainRunLoop()) while this function is executing. Any attempts to touch the run loop may cause non-deterministic behavior.

    @warning This form of alwaysTo does not work in any kind of async context. Use the async form of alwaysTo if you are running tests in an async context.

    Declaration

    Swift

    @available(*, noasync, message: "the sync version of `alwaysTo` does not work in async contexts. Use the async version with the same name as a drop-in replacement")
    @discardableResult
    public func alwaysTo(_ predicate: Predicate<Value>, until: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) -> SyncExpectation<Value>