Skip to content
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

Entities: Remove AssertionFailure.taskExplicitlyCanceled case #19

Merged
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
12 changes: 2 additions & 10 deletions Sources/Entities/AsyncStub.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// An `AsyncStub` provides hardcoded answers to calls made during the test.

Check warning on line 1 in Sources/Entities/AsyncStub.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Orphaned Doc Comment Violation: A doc comment should be attached to a declaration. (orphaned_doc_comment)
@available(iOS 13, macOS 10.15, *)
actor AsyncStub<Value> {

Expand Down Expand Up @@ -27,11 +27,7 @@
.handleFatalError(.testDoubleTypeMismatch(expected: "Async", received: "Throwing"), location: nil)
}

do {
try await Task.sleep(nanoseconds: delayInNanoseconds)
} catch {
FailureReporter.handler.handleFatalError(.taskExplicitlyCanceled, location: nil)
}
try? await Task.sleep(nanoseconds: delayInNanoseconds)
return result
}
}
Expand All @@ -41,11 +37,7 @@

@Sendable
func throwingAsyncInvoke(arguments: [Any]) async throws -> Value {
do {
try await Task.sleep(nanoseconds: delayInNanoseconds)
} catch {
FailureReporter.handler.handleFatalError(.taskExplicitlyCanceled, location: nil)
}
try await Task.sleep(nanoseconds: delayInNanoseconds)

switch stubbedValue {
case .success(let value):
Expand Down
3 changes: 0 additions & 3 deletions Sources/FailureReporter/AssertionFailure.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ public enum AssertionFailure: Error {
case expectedToBeCalledOnce(calledCount: Int)
case expectedToBeCalledTimes(expectedCount: Int, calledCount: Int)
case testDoubleTypeMismatch(expected: String, received: String)
case taskExplicitlyCanceled
}

extension AssertionFailure {
Expand All @@ -34,8 +33,6 @@ extension AssertionFailure {
return "Expected to be called \(expectedCount) time(s) but called \(calledCount) time(s)"
case .testDoubleTypeMismatch(let expected, let received):
return "Expected closure to be type of \(expected), received \(received)"
case .taskExplicitlyCanceled:
return "Task explicitly canceled"
}
}
}
Loading