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 theonFailure(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 thestatus
property. -
Undocumented
Declaration
Swift
public var location: SourceLocation { get }
-
Tests the actual value using a matcher to match.
Declaration
Swift
@discardableResult public func to(_ predicate: Predicate<Value>, description: String? = nil) -> SyncExpectation<Value>
-
Tests the actual value using a matcher to not match.
Declaration
Swift
@discardableResult public func toNot(_ predicate: Predicate<Value>, description: String? = nil) -> SyncExpectation<Value>
-
Tests the actual value using a matcher to not match.
Alias to toNot().
Declaration
Swift
@discardableResult public func notTo(_ predicate: Predicate<Value>, description: String? = nil) -> SyncExpectation<Value>
-
Undocumented
Declaration
Swift
public static func == (lhs: SyncExpectation, rhs: ExpectationNil)
-
Undocumented
Declaration
Swift
public static func != (lhs: SyncExpectation, rhs: ExpectationNil)
-
toEventually(_:
Asynchronoustimeout: pollInterval: description: ) 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: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> SyncExpectation<Value>
-
toEventuallyNot(_:
Asynchronoustimeout: pollInterval: description: ) 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: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> SyncExpectation<Value>
-
toNotEventually(_:
Asynchronoustimeout: pollInterval: description: ) 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: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> SyncExpectation<Value>
-
toNever(_:
Asynchronousuntil: pollInterval: description: ) 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: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> SyncExpectation<Value>
-
neverTo(_:
Asynchronousuntil: pollInterval: description: ) 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: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> SyncExpectation<Value>
-
toAlways(_:
Asynchronousuntil: pollInterval: description: ) 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: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) async -> SyncExpectation<Value>
-
alwaysTo(_:
Asynchronousuntil: pollInterval: description: ) 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: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.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 oftoEventually
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: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.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 oftoEventuallyNot
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: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.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 oftoNotEventually
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: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.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 oftoNever
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: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.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 ofneverTo
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: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.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 oftoAlways
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: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.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 ofalwaysTo
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: NimbleTimeInterval = PollingDefaults.timeout, pollInterval: NimbleTimeInterval = PollingDefaults.pollInterval, description: String? = nil) -> SyncExpectation<Value>