Skip to content

Commit 1b6f355

Browse files
committed
Speed up test
1 parent 8da48c7 commit 1b6f355

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Tests/AllocatedLockTests.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,21 @@ final class AllocatedLockTests: XCTestCase {
5656
XCTAssertTrue(value)
5757
}
5858

59+
5960
func testLock_Blocks() async {
6061
let lock = AllocatedLock()
62+
await MainActor.run {
63+
lock.unsafeLock()
64+
}
6165

6266
Task { @MainActor in
63-
lock.unsafeLock()
64-
try? await Task.sleep(nanoseconds: 1_000_000_000)
67+
try? await Task.sleep(nanoseconds: 200_000)
6568
lock.unsafeUnlock()
6669
}
6770

68-
try? await Task.sleep(nanoseconds: 500_000)
69-
7071
let results = await withTaskGroup(of: Bool.self) { group in
7172
group.addTask {
72-
try? await Task.sleep(nanoseconds: 5_000_000)
73+
try? await Task.sleep(nanoseconds: 10_000)
7374
return true
7475
}
7576
group.addTask {

0 commit comments

Comments
 (0)