From af772505ed8e980cf84df5a9244615da8fd255fb Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Sun, 4 Oct 2026 09:29:22 +1100 Subject: [PATCH] Drop an unused Combine import and await the cancelled lazy-sequence task StreamedTests imports Combine without using it, which stops the test target compiling where Combine is absent. The AsyncLazySequence cancellation test returned while its Task was still awaiting an expectation; corelibs-XCTest reports that as an unwaited expectation, so the test is now async and awaits the task. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01T8cahEd4GfsHQ89sNrmP4p --- Tests/AsyncSubjets/StreamedTests.swift | 1 - Tests/Creators/AsyncLazySequenceTests.swift | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Tests/AsyncSubjets/StreamedTests.swift b/Tests/AsyncSubjets/StreamedTests.swift index 02e6951..a995d8f 100644 --- a/Tests/AsyncSubjets/StreamedTests.swift +++ b/Tests/AsyncSubjets/StreamedTests.swift @@ -6,7 +6,6 @@ // import AsyncExtensions -import Combine import XCTest final class StreamedTests: XCTestCase { diff --git a/Tests/Creators/AsyncLazySequenceTests.swift b/Tests/Creators/AsyncLazySequenceTests.swift index 0f4e941..a077a51 100644 --- a/Tests/Creators/AsyncLazySequenceTests.swift +++ b/Tests/Creators/AsyncLazySequenceTests.swift @@ -23,7 +23,7 @@ final class AsyncLazySequenceTests: XCTestCase { XCTAssertEqual(receivedResult, sequence) } - func test_AsyncLazySequence_returns_an_asyncSequence_that_finishes_when_task_is_cancelled() { + func test_AsyncLazySequence_returns_an_asyncSequence_that_finishes_when_task_is_cancelled() async { let canCancelExpectation = expectation(description: "The first element has been emitted") let hasCancelExceptation = expectation(description: "The task has been cancelled") @@ -41,10 +41,12 @@ final class AsyncLazySequenceTests: XCTestCase { XCTAssertEqual(firstElement!, 0) // the AsyncSequence is cancelled having only emitted the first element } - wait(for: [canCancelExpectation], timeout: 5) // one element has been emitted, we can cancel the task + await fulfillment(of: [canCancelExpectation], timeout: 5) // one element has been emitted, we can cancel the task task.cancel() hasCancelExceptation.fulfill() // we can release the lock in the for loop + + await task.value } }