Skip to content

Commit

Permalink
use withExtendedLifetime to preserve the producer side
Browse files Browse the repository at this point in the history
  • Loading branch information
dnadoba committed Apr 11, 2023
1 parent b1af3eb commit c7863f6
Showing 1 changed file with 8 additions and 3 deletions.
Expand Up @@ -487,7 +487,10 @@ final class NIOThrowingAsyncSequenceProducerTests: XCTestCase {
task.cancel()
let result = await task.result
XCTAssertEqualWithoutAutoclosure(await delegate.events.prefix(1).collect(), [.didTerminate])
XCTAssertNil(try result.get())

try withExtendedLifetime(new.source) {
XCTAssertNil(try result.get())
}
}

func testTaskCancel_whenStreaming_andNotSuspended() async throws {
Expand Down Expand Up @@ -569,9 +572,11 @@ final class NIOThrowingAsyncSequenceProducerTests: XCTestCase {
}

task.cancel()

let result = await task.result
XCTAssertNil(try result.get())
try withExtendedLifetime(new.source) {
XCTAssertNil(try result.get())
}
}

// MARK: - Next
Expand Down

0 comments on commit c7863f6

Please sign in to comment.