Skip to content

Commit b8238d0

Browse files
committed
fix: fix failing clock unit test
1 parent 77ad9dc commit b8238d0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Tests/DeadlineTests/DeadlineTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,16 @@ import Testing
8181

8282
struct CustomError: Error { }
8383
struct CustomClock: Clock {
84-
let _internal = TestClock()
85-
var now: TestClock<Duration>.Instant { _internal.now }
86-
var minimumResolution: TestClock<Duration>.Duration { _internal.minimumResolution }
84+
var now: ContinuousClock.Instant { fatalError() }
85+
var minimumResolution: ContinuousClock.Duration { fatalError() }
8786
func sleep(until deadline: Instant, tolerance: Duration? = nil) async throws { throw CustomError() }
8887
}
8988

9089
let customClock = CustomClock()
90+
let testClock = TestClock()
9191
let task = Task {
92-
try await deadline(until: .init(offset: .milliseconds(200)), clock: customClock) {
93-
try await customClock.sleep(until: .init(offset: .milliseconds(100)))
92+
try await deadline(until: .now.advanced(by: .milliseconds(200)), clock: customClock) {
93+
try await testClock.sleep(until: .init(offset: .milliseconds(100)))
9494
}
9595
}
9696

0 commit comments

Comments
 (0)