We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1896b58 commit f93f952Copy full SHA for f93f952
Tests/TimeoutTests.swift
@@ -119,6 +119,24 @@ struct TimeoutTests {
119
try await TestActor("Fish").returningValue(after: 0.1, before: .now)
120
}
121
122
+
123
+ @Test
124
+ func returnsValueWithClock_beforeDeadlineExpires() async throws {
125
+ #expect(
126
+ try await withThrowingTimeout(after: .now + .seconds(2), clock: ContinuousClock()) {
127
+ "Fish"
128
+ } == "Fish"
129
+ )
130
+ }
131
132
133
+ func throwsErrorWithClock_WhenDeadlineExpires() async {
134
+ await #expect(throws: TimeoutError.self) {
135
+ try await withThrowingTimeout(after: .now, clock: ContinuousClock()) {
136
+ try await Task.sleep(for: .seconds(2))
137
138
139
140
141
142
public struct NonSendable<T> {
0 commit comments