restores Helder in all its glory

This commit is contained in:
2026-09-28 11:34:49 +02:00
parent c2b38b853c
commit 1d29d0952d
280 changed files with 29205 additions and 7 deletions
@@ -0,0 +1,22 @@
import Foundation
/// A value behind a lock, so a fake can be `Sendable` and still be read synchronously from a test.
final class Locked<Value>: @unchecked Sendable {
private let lock = NSLock()
private var value: Value
init(_ value: Value) {
self.value = value
}
var current: Value { lock.withLock { value } }
@discardableResult
func mutate<T>(_ change: (inout Value) throws -> T) rethrows -> T {
lock.lock()
defer { lock.unlock() }
return try change(&value)
}
}
struct FakeError: Error {}