-
Notifications
You must be signed in to change notification settings - Fork 269
Closed
Description
Hi folks,
It looks like the fulfillment(…) methods on XCTestCase and XCTWaiter are both missing on Linux.
It would be helpful to have API parity here, as Xcode 14.3 complains if I use the older wait(…) methods:
Instance method 'wait' is unavailable from asynchronous contexts; Use await fulfillment(of:timeout:enforceOrder:) instead; this is an error in Swift 6
Here are the missing methods:
extension XCTestCase {
/// Waits on a group of expectations for up to the specified timeout,
/// optionally enforcing their order of fulfillment.
///
/// - Parameters:
/// - expectations: An array of expectations that must be fulfilled.
/// - seconds: The number of seconds within which all expectations must
/// be fulfilled. The default timeout allows the test to run until
/// it reaches its execution time allowance.
/// - enforceOrderOfFulfillment: If `true`, the expectations specified
/// by the `expectations` parameter must be satisfied in the order
/// they appear in the array.
///
/// Expectations can only appear in the list once. This function may return
/// early based on fulfillment of the provided expectations.
///
/// - Note: If you do not specify a timeout when calling this function, it
/// is recommended that you enable test timeouts to prevent a runaway
/// expectation from hanging the test.
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
@nonobjc public func fulfillment(of expectations: [XCTestExpectation], timeout seconds: TimeInterval = .infinity, enforceOrder enforceOrderOfFulfillment: Bool = false) async
}
extension XCTWaiter {
/// Waits on a group of expectations for up to the specified timeout,
/// optionally enforcing their order of fulfillment.
///
/// - Parameters:
/// - expectations: An array of expectations that must be fulfilled.
/// - seconds: The number of seconds within which all expectations must
/// be fulfilled. The default timeout allows the test to run until
/// it reaches its execution time allowance.
/// - enforceOrderOfFulfillment: If `true`, the expectations specified
/// by the `expectations` parameter must be satisfied in the order
/// they appear in the array.
///
/// - Returns: A value describing the outcome of waiting for `expectations`.
///
/// Expectations can only appear in the list once. This function may return
/// early based on fulfillment of the provided expectations.
///
/// - Note: If you do not specify a timeout when calling this function, it
/// is recommended that you enable test timeouts to prevent a runaway
/// expectation from hanging the test.
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
@discardableResult
@nonobjc public func fulfillment(of expectations: [XCTestExpectation], timeout seconds: TimeInterval = .infinity, enforceOrder enforceOrderOfFulfillment: Bool = false) async -> XCTWaiter.Result
/// Creates a waiter that waits on a group of expectations for up to the
/// specified timeout, optionally enforcing their order of fulfillment.
///
/// - Parameters:
/// - expectations: An array of expectations that must be fulfilled.
/// - seconds: The number of seconds within which all expectations must
/// be fulfilled. The default timeout allows the test to run until
/// it reaches its execution time allowance.
/// - enforceOrderOfFulfillment: If `true`, the expectations specified
/// by the `expectations` parameter must be satisfied in the order
/// they appear in the array.
///
/// - Returns: A value describing the outcome of waiting for `expectations`.
///
/// Expectations can only appear in the list once. This function may return
/// early based on fulfillment of the provided expectations.
///
/// The waiter is discarded when the wait completes.
///
/// - Note: If you do not specify a timeout when calling this function, it
/// is recommended that you enable test timeouts to prevent a runaway
/// expectation from hanging the test.
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
@nonobjc public class func fulfillment(of expectations: [XCTestExpectation], timeout seconds: TimeInterval = .infinity, enforceOrder enforceOrderOfFulfillment: Bool = false) async -> XCTWaiter.Result
}jbelkins, o-nnerb, dirtyhenry and mattmassicotte
Metadata
Metadata
Assignees
Labels
No labels