Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

690 B
Raw Blame
@testable import PeelCore
import Testing

@MainActor
struct OneRunAtATimeTests {
    @Test func runsOnceMoreForTheCallsMadeWhileItRan() async {
        let runs = OneRunAtATime()
        var count = 0
        var release: CheckedContinuation<Void, Never>?

        let first = Task {
            await runs.run {
                count += 1
                if count == 1 { await withCheckedContinuation { release = $0 } }
            }
        }
        while release == nil { await Task.yield() }
        await runs.run { count += 1 }
        await runs.run { count += 1 }
        #expect(count == 1)
        release?.resume()
        await first.value

        #expect(count == 2)
    }
}