Skip to content

Commit 08f34f2

Browse files
committed
more deinit tests
1 parent f24b8b1 commit 08f34f2

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Tests/FoundationEssentialsTests/ProgressManager/ProgressManagerTests.swift

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ extension Tag {
352352
manager.complete(count: 2)
353353
}
354354

355-
@Test func finishedChild() async throws {
355+
@Test func finishedChildUnreadBeforeDeinit() async throws {
356356
let manager = ProgressManager(totalCount: 2)
357357

358358
manager.complete(count: 1)
@@ -362,6 +362,20 @@ extension Tag {
362362
#expect(manager.fractionCompleted == 1.0)
363363
}
364364

365+
@Test func finishedChildReadBeforeDeinit() async throws {
366+
let manager = ProgressManager(totalCount: 2)
367+
368+
manager.complete(count: 1)
369+
#expect(manager.fractionCompleted == 0.5)
370+
371+
var child: ProgressManager? = manager.subprogress(assigningCount: 1).start(totalCount: 1)
372+
child?.complete(count: 1)
373+
#expect(manager.fractionCompleted == 1.0)
374+
375+
child = nil
376+
#expect(manager.fractionCompleted == 1.0)
377+
}
378+
365379
@Test func uninitializedSubprogress() async throws {
366380
let manager = ProgressManager(totalCount: 2)
367381

0 commit comments

Comments
 (0)