diff --git a/ShadowsocksX-NG2/Tests/Subscription/SubscriptionAutoUpdateWorkflowTests+Lifecycle.swift b/ShadowsocksX-NG2/Tests/Subscription/SubscriptionAutoUpdateWorkflowTests+Lifecycle.swift index 3b390066..94330f8e 100644 --- a/ShadowsocksX-NG2/Tests/Subscription/SubscriptionAutoUpdateWorkflowTests+Lifecycle.swift +++ b/ShadowsocksX-NG2/Tests/Subscription/SubscriptionAutoUpdateWorkflowTests+Lifecycle.swift @@ -95,7 +95,7 @@ extension SubscriptionAutoUpdateWorkflowTests { clockReads += 1 return fixture.now }) - weak var releasedWorkflow = workflow + let workflowIsReleased = { [weak workflow] in workflow == nil } defer { workflow?.stopSubscriptionAutomaticUpdates() fetcher.releaseAll() @@ -106,9 +106,8 @@ extension SubscriptionAutoUpdateWorkflowTests { workflow?.stopSubscriptionAutomaticUpdates() workflow = nil fetcher.releaseAll() - try await requireTestCondition("stopped batch released its workflow") { - releasedWorkflow == nil - } + try await requireTestCondition( + "stopped batch released its workflow", condition: workflowIsReleased) #expect(clockReads == readsBeforeStop) } }