Skip to content

Commit 5e9c8bc

Browse files
committed
Add a test
1 parent 2ab69cf commit 5e9c8bc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Tests/TestingTests/Support/LockTests.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,17 @@ struct LockTests {
2222
}
2323
#expect(lock.rawValue == 1)
2424
}
25+
26+
@Test("Repeatedly accessing a lock")
27+
func lockRepeatedly() async {
28+
let lock = Locked(rawValue: 0)
29+
await withTaskGroup { taskGroup in
30+
for _ in 0 ..< 100_000 {
31+
taskGroup.addTask {
32+
lock.increment()
33+
}
34+
}
35+
}
36+
#expect(lock.rawValue == 100_000)
37+
}
2538
}

0 commit comments

Comments
 (0)