swift-nio/Tests/NIOCoreTests
David Nadoba e0cc6dd6ff
Throw `CancellationError` instead of returning `nil` during early cancellation. (#2401)
### Motivation:
Follow up PR for https://github.com/apple/swift-nio/pull/2399

We currently still return `nil` if the current `Task` is canceled before the first call to `NIOThrowingAsyncSequenceProducer.AsyncIterator.next()` but it should throw `CancellationError` too.

In addition, the generic `Failure` type turns out to be a problem. Just throwing a `CancellationError` without checking that `Failure` type is `any Swift.Error` or `CancellationError` introduced a type safety violation as we throw an unrelated type.

### Modifications:

- throw `CancellationError` on eager cancellation
-  deprecates the generic `Failure` type of `NIOThrowingAsyncSequenceProducer`. It now must always be `any Swift.Error`. For backward compatibility we will still return nil if `Failure` is not `any Swift.Error` or `CancellationError`.

### Result:

`CancellationError` is now correctly thrown instead of returning `nil` on eager cancelation. Generic `Failure` type is deprecated.
2023-04-11 08:58:01 -07:00
..
AsyncChannel Land `NIOAsyncChannel` as SPI (#2397) 2023-04-06 05:26:32 -07:00
AsyncSequences Throw `CancellationError` instead of returning `nil` during early cancellation. (#2401) 2023-04-11 08:58:01 -07:00
AddressedEnvelopeTests+XCTest.swift Conform `AddressedEnvelope` conditionally to `Hashable` & `Equatable` (#2017) 2021-12-20 10:22:13 -08:00
AddressedEnvelopeTests.swift Conform `AddressedEnvelope` conditionally to `Hashable` & `Equatable` (#2017) 2021-12-20 10:22:13 -08:00
AsyncSequenceTests+XCTest.swift Add `collect(upTo:) -> ByteBuffer` and variations to `AsyncSequence` (#2038) 2022-02-03 10:31:09 -08:00
AsyncSequenceTests.swift Use #fileID/#filePath instead of #file (#2306) 2022-11-03 16:43:13 +00:00
BaseObjectsTest+XCTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
BaseObjectsTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
ByteBufferLengthPrefixTests+XCTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
ByteBufferLengthPrefixTests.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
ByteBufferTest+XCTest.swift add witnesses for ByteBufferView.reserveCapacity(_:), append(_:), and append(contentsOf:) (#2309) 2022-11-14 10:01:25 +00:00
ByteBufferTest.swift Avoid integer literals that won't fit. (#2348) 2023-01-13 13:53:17 +00:00
ChannelOptionStorageTest+XCTest.swift Add support for removing channel options (#2297) 2022-10-24 20:25:42 +01:00
ChannelOptionStorageTest.swift Add support for removing channel options (#2297) 2022-10-24 20:25:42 +01:00
CircularBufferTests+XCTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
CircularBufferTests.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
CustomChannelTests+XCTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
CustomChannelTests.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
DispatchQueue+WithFutureTest+XCTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
DispatchQueue+WithFutureTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
IOErrorTest+XCTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
IOErrorTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
IntegerTypesTest+XCTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
IntegerTypesTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
LinuxTest+XCTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
LinuxTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
MarkedCircularBufferTests+XCTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
MarkedCircularBufferTests.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
NIOAnyDebugTest+XCTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
NIOAnyDebugTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
NIOCloseOnErrorHandlerTest+XCTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
NIOCloseOnErrorHandlerTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
RecvByteBufAllocatorTest+XCTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
RecvByteBufAllocatorTest.swift Use #fileID/#filePath instead of #file (#2306) 2022-11-03 16:43:13 +00:00
SingleStepByteToMessageDecoderTest+XCTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
SingleStepByteToMessageDecoderTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
TimeAmount+DurationTests+XCTest.swift Move 5.7 beta APIs to NIOCore (#2300) 2022-10-25 15:38:47 +01:00
TimeAmount+DurationTests.swift Move 5.7 beta APIs to NIOCore (#2300) 2022-10-25 15:38:47 +01:00
TimeAmountTests+XCTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
TimeAmountTests.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
TypeAssistedChannelHandlerTests+XCTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
TypeAssistedChannelHandlerTests.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
UtilitiesTest+XCTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
UtilitiesTest.swift Move tests of NIOCore types from NIOPosixTests to NIOCoreTests (#2093) 2022-05-04 08:14:18 -07:00
XCTest+AsyncAwait.swift Land `NIOAsyncChannel` as SPI (#2397) 2023-04-06 05:26:32 -07:00
XCTest+Extensions.swift Use #fileID/#filePath instead of #file (#2306) 2022-11-03 16:43:13 +00:00