8000 Mark the sync versions of toEventually as nonasync by younata · Pull Request #1010 · Quick/Nimble · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Mark the sync versions of toEventually as nonasync #1010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Sources/Nimble/DSL+Wait.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ internal func blockedRunLoopErrorMessageFor(_ fnName: String, leeway: DispatchTi
///
/// 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.
@available(*, noasync, message: "the sync version of `waitUntil` does not work in async contexts. Use the async version with the same name as a drop-in replacement")
public func waitUntil(timeout: DispatchTimeInterval = AsyncDefaults.timeout, file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) -> Void) {
NMBWait.until(timeout: timeout, file: file, line: line, action: action)
}
Expand Down
7 changes: 7 additions & 0 deletions Sources/Nimble/Polling.swift
EF24
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ extension SyncExpectation {
/// @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.
@discardableResult
@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")
public func toEventually(_ predicate: Predicate<Value>, timeout: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) -> Self {
nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue)

Expand Down Expand Up @@ -131,6 +132,7 @@ extension SyncExpectation {
/// 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.
@discardableResult
@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")
public func toEventuallyNot(_ predicate: Predicate<Value>, timeout: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) -> Self {
nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue)

Expand Down Expand Up @@ -165,6 +167,7 @@ extension SyncExpectation {
/// 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.
@discardableResult
@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")
public func toNotEventually(_ predicate: Predicate<Value>, timeout: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) -> Self {
return toEventuallyNot(predicate, timeout: timeout, pollInterval: pollInterval, description: description)
}
Expand All @@ -180,6 +183,7 @@ extension SyncExpectation {
/// 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.
@discardableResult
@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")
public func toNever(_ predicate: Predicate<Value>, until: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) -> Self {
nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue)

Expand Down Expand Up @@ -214,6 +218,7 @@ extension SyncExpectation {
/// 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.
@discardableResult
@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")
public func neverTo(_ predicate: Predicate<Value>, until: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) -> Self {
return toNever(predicate, until: until, pollInterval: pollInterval, description: description)
}
Expand All @@ -229,6 +234,7 @@ extension SyncExpectation {
/// 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.
@discardableResult
@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")
public func toAlways(_ predicate: Predicate<Value>, until: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) -> Self {
nimblePrecondition(expression.isClosure, "NimbleInternalError", toEventuallyRequiresClosureError.stringValue)

Expand Down Expand Up @@ -263,6 +269,7 @@ extension SyncExpectation {
/// 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.
@discardableResult
@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")
public func alwaysTo(_ predicate: Predicate<Value>, until: DispatchTimeInterval = AsyncDefaults.timeout, pollInterval: DispatchTimeInterval = AsyncDefaults.pollInterval, description: String? = nil) -> Self {
return toAlways(predicate, until: until, pollInterval: pollInterval, description: description)
}
Expand Down
0