allow deprecated tests to test deprecated functionality (#1271)

Motivation:

It's important to also test deprecated functionliaty. One way of
achieving this without warnings is to also deprecate the tests that test
this deprecated functionality. Unfortunately, on Linux we need to
generate lists of tests which would then reference deprecated tests
(which gives us a warning).

Modifications:

Deprecate test suites and the main test runner all the way to the top so
never get warnings.

Result:

Possible to test deprecated functionlity without warnings.
This commit is contained in:
Johannes Weiss 2019-11-27 14:26:51 +00:00 committed by GitHub
parent 302dee3e1a
commit c2c725044a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
71 changed files with 178 additions and 75 deletions

View File

@ -31,76 +31,87 @@ import XCTest
@testable import NIOTests
@testable import NIOWebSocketTests
XCTMain([
testCase(AcceptBackoffHandlerTest.allTests),
testCase(AdaptiveRecvByteBufferAllocatorTest.allTests),
testCase(ApplicationProtocolNegotiationHandlerTests.allTests),
testCase(Base64Test.allTests),
testCase(BaseObjectTest.allTests),
testCase(BlockingIOThreadPoolTest.allTests),
testCase(BootstrapTest.allTests),
testCase(ByteBufferTest.allTests),
testCase(ByteBufferUtilsTest.allTests),
testCase(ByteToMessageDecoderTest.allTests),
testCase(ByteToMessageDecoderVerifierTest.allTests),
testCase(ChannelNotificationTest.allTests),
testCase(ChannelOptionStorageTest.allTests),
testCase(ChannelPipelineTest.allTests),
testCase(ChannelTests.allTests),
testCase(CircularBufferTests.allTests),
testCase(CodableByteBufferTest.allTests),
testCase(CustomChannelTests.allTests),
testCase(DatagramChannelTests.allTests),
testCase(EchoServerClientTest.allTests),
testCase(EmbeddedChannelTest.allTests),
testCase(EmbeddedEventLoopTest.allTests),
testCase(EventCounterHandlerTest.allTests),
testCase(EventLoopFutureTest.allTests),
testCase(EventLoopTest.allTests),
testCase(FileRegionTest.allTests),
testCase(GetaddrinfoResolverTest.allTests),
testCase(HTTPClientUpgradeTestCase.allTests),
testCase(HTTPDecoderLengthTest.allTests),
testCase(HTTPDecoderTest.allTests),
testCase(HTTPHeadersTest.allTests),
testCase(HTTPRequestEncoderTests.allTests),
testCase(HTTPResponseEncoderTests.allTests),
testCase(HTTPResponseStatusTests.allTests),
testCase(HTTPServerClientTest.allTests),
testCase(HTTPServerPipelineHandlerTest.allTests),
testCase(HTTPServerProtocolErrorHandlerTest.allTests),
testCase(HTTPServerUpgradeTestCase.allTests),
testCase(HTTPTest.allTests),
testCase(HTTPTypesTest.allTests),
testCase(HappyEyeballsTest.allTests),
testCase(HeapTests.allTests),
testCase(IdleStateHandlerTest.allTests),
testCase(IntegerTypesTest.allTests),
testCase(MarkedCircularBufferTests.allTests),
testCase(MessageToByteEncoderTest.allTests),
testCase(MessageToByteHandlerTest.allTests),
testCase(MulticastTest.allTests),
testCase(NIOAnyDebugTest.allTests),
testCase(NIOCloseOnErrorHandlerTest.allTests),
testCase(NIOConcurrencyHelpersTests.allTests),
testCase(NIOHTTP1TestServerTest.allTests),
testCase(NonBlockingFileIOTest.allTests),
testCase(PendingDatagramWritesManagerTests.allTests),
testCase(PipeChannelTest.allTests),
testCase(PriorityQueueTest.allTests),
testCase(SNIHandlerTest.allTests),
testCase(SelectorTest.allTests),
testCase(SocketAddressTest.allTests),
testCase(SocketChannelTest.allTests),
testCase(SocketOptionProviderTest.allTests),
testCase(StreamChannelTest.allTests),
testCase(SystemTest.allTests),
testCase(ThreadTest.allTests),
testCase(TypeAssistedChannelHandlerTest.allTests),
testCase(UtilitiesTest.allTests),
testCase(WebSocketClientEndToEndTests.allTests),
testCase(WebSocketFrameDecoderTest.allTests),
testCase(WebSocketFrameEncoderTest.allTests),
testCase(WebSocketServerEndToEndTests.allTests),
])
// This protocol is necessary to we can call the 'run' method (on an existential of this protocol)
// without the compiler noticing that we're calling a deprecated function.
// This hack exists so we can deprecate individual tests which test deprecated functionality without
// getting a compiler warning...
protocol LinuxMainRunner { func run() }
class LinuxMainRunnerImpl: LinuxMainRunner {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
func run() {
XCTMain([
testCase(AcceptBackoffHandlerTest.allTests),
testCase(AdaptiveRecvByteBufferAllocatorTest.allTests),
testCase(ApplicationProtocolNegotiationHandlerTests.allTests),
testCase(Base64Test.allTests),
testCase(BaseObjectTest.allTests),
testCase(BlockingIOThreadPoolTest.allTests),
testCase(BootstrapTest.allTests),
testCase(ByteBufferTest.allTests),
testCase(ByteBufferUtilsTest.allTests),
testCase(ByteToMessageDecoderTest.allTests),
testCase(ByteToMessageDecoderVerifierTest.allTests),
testCase(ChannelNotificationTest.allTests),
testCase(ChannelOptionStorageTest.allTests),
testCase(ChannelPipelineTest.allTests),
testCase(ChannelTests.allTests),
testCase(CircularBufferTests.allTests),
testCase(CodableByteBufferTest.allTests),
testCase(CustomChannelTests.allTests),
testCase(DatagramChannelTests.allTests),
testCase(EchoServerClientTest.allTests),
testCase(EmbeddedChannelTest.allTests),
testCase(EmbeddedEventLoopTest.allTests),
testCase(EventCounterHandlerTest.allTests),
testCase(EventLoopFutureTest.allTests),
testCase(EventLoopTest.allTests),
testCase(FileRegionTest.allTests),
testCase(GetaddrinfoResolverTest.allTests),
testCase(HTTPClientUpgradeTestCase.allTests),
testCase(HTTPDecoderLengthTest.allTests),
testCase(HTTPDecoderTest.allTests),
testCase(HTTPHeadersTest.allTests),
testCase(HTTPRequestEncoderTests.allTests),
testCase(HTTPResponseEncoderTests.allTests),
testCase(HTTPResponseStatusTests.allTests),
testCase(HTTPServerClientTest.allTests),
testCase(HTTPServerPipelineHandlerTest.allTests),
testCase(HTTPServerProtocolErrorHandlerTest.allTests),
testCase(HTTPServerUpgradeTestCase.allTests),
testCase(HTTPTest.allTests),
testCase(HTTPTypesTest.allTests),
testCase(HappyEyeballsTest.allTests),
testCase(HeapTests.allTests),
testCase(IdleStateHandlerTest.allTests),
testCase(IntegerTypesTest.allTests),
testCase(MarkedCircularBufferTests.allTests),
testCase(MessageToByteEncoderTest.allTests),
testCase(MessageToByteHandlerTest.allTests),
testCase(MulticastTest.allTests),
testCase(NIOAnyDebugTest.allTests),
testCase(NIOCloseOnErrorHandlerTest.allTests),
testCase(NIOConcurrencyHelpersTests.allTests),
testCase(NIOHTTP1TestServerTest.allTests),
testCase(NonBlockingFileIOTest.allTests),
testCase(PendingDatagramWritesManagerTests.allTests),
testCase(PipeChannelTest.allTests),
testCase(PriorityQueueTest.allTests),
testCase(SNIHandlerTest.allTests),
testCase(SelectorTest.allTests),
testCase(SocketAddressTest.allTests),
testCase(SocketChannelTest.allTests),
testCase(SocketOptionProviderTest.allTests),
testCase(StreamChannelTest.allTests),
testCase(SystemTest.allTests),
testCase(ThreadTest.allTests),
testCase(TypeAssistedChannelHandlerTest.allTests),
testCase(UtilitiesTest.allTests),
testCase(WebSocketClientEndToEndTests.allTests),
testCase(WebSocketFrameDecoderTest.allTests),
testCase(WebSocketFrameEncoderTest.allTests),
testCase(WebSocketServerEndToEndTests.allTests),
])
}
}
(LinuxMainRunnerImpl() as LinuxMainRunner).run()
#endif

View File

@ -24,6 +24,7 @@ import XCTest
extension NIOConcurrencyHelpersTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (NIOConcurrencyHelpersTests) -> () throws -> Void)] {
return [
("testLargeContendedAtomicSum", testLargeContendedAtomicSum),

View File

@ -24,6 +24,7 @@ import XCTest
extension CodableByteBufferTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (CodableByteBufferTest) -> () throws -> Void)] {
return [
("testSimpleDecode", testSimpleDecode),

View File

@ -24,6 +24,7 @@ import XCTest
extension ByteBufferUtilsTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (ByteBufferUtilsTest) -> () throws -> Void)] {
return [
("testComparators", testComparators),

View File

@ -24,6 +24,7 @@ import XCTest
extension HTTPClientUpgradeTestCase {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (HTTPClientUpgradeTestCase) -> () throws -> Void)] {
return [
("testSimpleUpgradeSucceeds", testSimpleUpgradeSucceeds),

View File

@ -24,6 +24,7 @@ import XCTest
extension HTTPDecoderLengthTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (HTTPDecoderLengthTest) -> () throws -> Void)] {
return [
("testHTTP11SemanticEOFOnChannelInactive", testHTTP11SemanticEOFOnChannelInactive),

View File

@ -24,6 +24,7 @@ import XCTest
extension HTTPDecoderTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (HTTPDecoderTest) -> () throws -> Void)] {
return [
("testDoesNotDecodeRealHTTP09Request", testDoesNotDecodeRealHTTP09Request),

View File

@ -24,6 +24,7 @@ import XCTest
extension HTTPHeadersTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (HTTPHeadersTest) -> () throws -> Void)] {
return [
("testCasePreservedButInsensitiveLookup", testCasePreservedButInsensitiveLookup),

View File

@ -24,6 +24,7 @@ import XCTest
extension HTTPRequestEncoderTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (HTTPRequestEncoderTests) -> () throws -> Void)] {
return [
("testNoAutoHeadersForHEAD", testNoAutoHeadersForHEAD),

View File

@ -24,6 +24,7 @@ import XCTest
extension HTTPResponseEncoderTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (HTTPResponseEncoderTests) -> () throws -> Void)] {
return [
("testNoAutoHeadersFor101", testNoAutoHeadersFor101),

View File

@ -24,6 +24,7 @@ import XCTest
extension HTTPResponseStatusTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (HTTPResponseStatusTests) -> () throws -> Void)] {
return [
("testHTTPResponseStatusFromStatusCode", testHTTPResponseStatusFromStatusCode),

View File

@ -24,6 +24,7 @@ import XCTest
extension HTTPServerClientTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (HTTPServerClientTest) -> () throws -> Void)] {
return [
("testSimpleGetByteBuffer", testSimpleGetByteBuffer),

View File

@ -24,6 +24,7 @@ import XCTest
extension HTTPServerPipelineHandlerTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (HTTPServerPipelineHandlerTest) -> () throws -> Void)] {
return [
("testBasicBufferingBehaviour", testBasicBufferingBehaviour),

View File

@ -24,6 +24,7 @@ import XCTest
extension HTTPServerProtocolErrorHandlerTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (HTTPServerProtocolErrorHandlerTest) -> () throws -> Void)] {
return [
("testHandlesBasicErrors", testHandlesBasicErrors),

View File

@ -24,6 +24,7 @@ import XCTest
extension HTTPServerUpgradeTestCase {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (HTTPServerUpgradeTestCase) -> () throws -> Void)] {
return [
("testUpgradeWithoutUpgrade", testUpgradeWithoutUpgrade),

View File

@ -24,6 +24,7 @@ import XCTest
extension HTTPTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (HTTPTest) -> () throws -> Void)] {
return [
("testHTTPSimpleNoHeaders", testHTTPSimpleNoHeaders),

View File

@ -24,6 +24,7 @@ import XCTest
extension HTTPTypesTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (HTTPTypesTest) -> () throws -> Void)] {
return [
("testConvertToString", testConvertToString),

View File

@ -24,6 +24,7 @@ import XCTest
extension ApplicationProtocolNegotiationHandlerTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (ApplicationProtocolNegotiationHandlerTests) -> () throws -> Void)] {
return [
("testChannelProvidedToCallback", testChannelProvidedToCallback),

View File

@ -24,6 +24,7 @@ import XCTest
extension SNIHandlerTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (SNIHandlerTest) -> () throws -> Void)] {
return [
("testLibre227NoSNIDripFeed", testLibre227NoSNIDripFeed),

View File

@ -24,6 +24,7 @@ import XCTest
extension ByteToMessageDecoderVerifierTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (ByteToMessageDecoderVerifierTest) -> () throws -> Void)] {
return [
("testWrongResults", testWrongResults),

View File

@ -24,6 +24,7 @@ import XCTest
extension EventCounterHandlerTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (EventCounterHandlerTest) -> () throws -> Void)] {
return [
("testNothingButEmbeddedChannelInit", testNothingButEmbeddedChannelInit),

View File

@ -24,6 +24,7 @@ import XCTest
extension NIOHTTP1TestServerTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (NIOHTTP1TestServerTest) -> () throws -> Void)] {
return [
("testTheExampleInTheDocs", testTheExampleInTheDocs),

View File

@ -24,6 +24,7 @@ import XCTest
extension AcceptBackoffHandlerTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (AcceptBackoffHandlerTest) -> () throws -> Void)] {
return [
("testECONNABORTED", testECONNABORTED),

View File

@ -24,6 +24,7 @@ import XCTest
extension BaseObjectTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (BaseObjectTest) -> () throws -> Void)] {
return [
("testNIOByteBufferConversion", testNIOByteBufferConversion),

View File

@ -24,6 +24,7 @@ import XCTest
extension BlockingIOThreadPoolTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (BlockingIOThreadPoolTest) -> () throws -> Void)] {
return [
("testDoubleShutdownWorks", testDoubleShutdownWorks),

View File

@ -24,6 +24,7 @@ import XCTest
extension BootstrapTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (BootstrapTest) -> () throws -> Void)] {
return [
("testBootstrapsCallInitializersOnCorrectEventLoop", testBootstrapsCallInitializersOnCorrectEventLoop),

View File

@ -24,6 +24,7 @@ import XCTest
extension ByteBufferTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (ByteBufferTest) -> () throws -> Void)] {
return [
("testAllocateAndCount", testAllocateAndCount),
@ -173,6 +174,7 @@ extension ByteBufferTest {
("testByteBufferAllocatorSize1Capacity", testByteBufferAllocatorSize1Capacity),
("testByteBufferModifiedWithoutAllocationLogic", testByteBufferModifiedWithoutAllocationLogic),
("testByteBufferModifyIfUniquelyOwnedMayThrow", testByteBufferModifyIfUniquelyOwnedMayThrow),
("testDeprecatedSetBytes", testDeprecatedSetBytes),
]
}
}

View File

@ -2441,6 +2441,15 @@ class ByteBufferTest: XCTestCase {
XCTAssertTrue(error is MyError)
}
}
@available(*, deprecated, message: "deprecated because it tests deprecated functionality")
func testDeprecatedSetBytes() {
self.buf.clear()
self.buf.writeString("hello")
self.buf.set(buffer: self.buf, at: 5)
self.buf.moveWriterIndex(forwardBy: 5)
XCTAssertEqual("hellohello", self.buf.readString(length: 10))
}
}
private enum AllocationExpectationState: Int {

View File

@ -24,6 +24,7 @@ import XCTest
extension ChannelNotificationTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (ChannelNotificationTest) -> () throws -> Void)] {
return [
("testNotificationOrder", testNotificationOrder),

View File

@ -24,6 +24,7 @@ import XCTest
extension ChannelOptionStorageTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (ChannelOptionStorageTest) -> () throws -> Void)] {
return [
("testWeStartWithNoOptions", testWeStartWithNoOptions),

View File

@ -24,6 +24,7 @@ import XCTest
extension ChannelPipelineTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (ChannelPipelineTest) -> () throws -> Void)] {
return [
("testGetHandler", testGetHandler),

View File

@ -24,6 +24,7 @@ import XCTest
extension ChannelTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (ChannelTests) -> () throws -> Void)] {
return [
("testBasicLifecycle", testBasicLifecycle),

View File

@ -24,6 +24,7 @@ import XCTest
extension CircularBufferTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (CircularBufferTests) -> () throws -> Void)] {
return [
("testTrivial", testTrivial),

View File

@ -24,6 +24,7 @@ import XCTest
extension ByteToMessageDecoderTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (ByteToMessageDecoderTest) -> () throws -> Void)] {
return [
("testDecoder", testDecoder),
@ -66,6 +67,7 @@ extension ByteToMessageDecoderTest {
extension MessageToByteEncoderTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (MessageToByteEncoderTest) -> () throws -> Void)] {
return [
("testEncoderOverrideAllocateOutBuffer", testEncoderOverrideAllocateOutBuffer),
@ -76,6 +78,7 @@ extension MessageToByteEncoderTest {
extension MessageToByteHandlerTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (MessageToByteHandlerTest) -> () throws -> Void)] {
return [
("testThrowingEncoderFailsPromises", testThrowingEncoderFailsPromises),

View File

@ -24,6 +24,7 @@ import XCTest
extension CustomChannelTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (CustomChannelTests) -> () throws -> Void)] {
return [
("testWritingIntToSpecialChannel", testWritingIntToSpecialChannel),

View File

@ -24,6 +24,7 @@ import XCTest
extension DatagramChannelTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (DatagramChannelTests) -> () throws -> Void)] {
return [
("testBasicChannelCommunication", testBasicChannelCommunication),

View File

@ -24,6 +24,7 @@ import XCTest
extension EchoServerClientTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (EchoServerClientTest) -> () throws -> Void)] {
return [
("testEcho", testEcho),

View File

@ -24,6 +24,7 @@ import XCTest
extension EmbeddedChannelTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (EmbeddedChannelTest) -> () throws -> Void)] {
return [
("testWriteOutboundByteBuffer", testWriteOutboundByteBuffer),

View File

@ -24,6 +24,7 @@ import XCTest
extension EmbeddedEventLoopTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (EmbeddedEventLoopTest) -> () throws -> Void)] {
return [
("testExecuteDoesNotImmediatelyRunTasks", testExecuteDoesNotImmediatelyRunTasks),

View File

@ -24,6 +24,7 @@ import XCTest
extension EventLoopFutureTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (EventLoopFutureTest) -> () throws -> Void)] {
return [
("testFutureFulfilledIfHasResult", testFutureFulfilledIfHasResult),

View File

@ -24,6 +24,7 @@ import XCTest
extension EventLoopTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (EventLoopTest) -> () throws -> Void)] {
return [
("testSchedule", testSchedule),

View File

@ -24,6 +24,7 @@ import XCTest
extension FileRegionTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (FileRegionTest) -> () throws -> Void)] {
return [
("testWriteFileRegion", testWriteFileRegion),

View File

@ -24,6 +24,7 @@ import XCTest
extension GetaddrinfoResolverTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (GetaddrinfoResolverTest) -> () throws -> Void)] {
return [
("testResolveNoDuplicatesV4", testResolveNoDuplicatesV4),

View File

@ -24,6 +24,7 @@ import XCTest
extension HappyEyeballsTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (HappyEyeballsTest) -> () throws -> Void)] {
return [
("testIPv4OnlyResolution", testIPv4OnlyResolution),

View File

@ -24,6 +24,7 @@ import XCTest
extension HeapTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (HeapTests) -> () throws -> Void)] {
return [
("testSimple", testSimple),

View File

@ -24,6 +24,7 @@ import XCTest
extension IdleStateHandlerTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (IdleStateHandlerTest) -> () throws -> Void)] {
return [
("testIdleRead", testIdleRead),

View File

@ -24,6 +24,7 @@ import XCTest
extension IntegerTypesTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (IntegerTypesTest) -> () throws -> Void)] {
return [
("testNextPowerOfOfTwoZero", testNextPowerOfOfTwoZero),

View File

@ -24,6 +24,7 @@ import XCTest
extension MarkedCircularBufferTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (MarkedCircularBufferTests) -> () throws -> Void)] {
return [
("testEmptyMark", testEmptyMark),

View File

@ -24,6 +24,7 @@ import XCTest
extension MulticastTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (MulticastTest) -> () throws -> Void)] {
return [
("testCanJoinBasicMulticastGroupIPv4", testCanJoinBasicMulticastGroupIPv4),

View File

@ -24,6 +24,7 @@ import XCTest
extension NIOAnyDebugTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (NIOAnyDebugTest) -> () throws -> Void)] {
return [
("testCustomStringConvertible", testCustomStringConvertible),

View File

@ -24,6 +24,7 @@ import XCTest
extension NIOCloseOnErrorHandlerTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (NIOCloseOnErrorHandlerTest) -> () throws -> Void)] {
return [
("testChannelCloseOnError", testChannelCloseOnError),

View File

@ -24,6 +24,7 @@ import XCTest
extension NonBlockingFileIOTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (NonBlockingFileIOTest) -> () throws -> Void)] {
return [
("testBasicFileIOWorks", testBasicFileIOWorks),

View File

@ -24,6 +24,7 @@ import XCTest
extension PendingDatagramWritesManagerTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (PendingDatagramWritesManagerTests) -> () throws -> Void)] {
return [
("testPendingWritesEmptyWritesWorkAndWeDontWriteUnflushedThings", testPendingWritesEmptyWritesWorkAndWeDontWriteUnflushedThings),

View File

@ -24,6 +24,7 @@ import XCTest
extension PipeChannelTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (PipeChannelTest) -> () throws -> Void)] {
return [
("testBasicIO", testBasicIO),

View File

@ -24,6 +24,7 @@ import XCTest
extension PriorityQueueTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (PriorityQueueTest) -> () throws -> Void)] {
return [
("testSomeStringsAsc", testSomeStringsAsc),

View File

@ -24,6 +24,7 @@ import XCTest
extension AdaptiveRecvByteBufferAllocatorTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (AdaptiveRecvByteBufferAllocatorTest) -> () throws -> Void)] {
return [
("testAdaptive", testAdaptive),

View File

@ -24,6 +24,7 @@ import XCTest
extension SelectorTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (SelectorTest) -> () throws -> Void)] {
return [
("testDeregisterWhileProcessingEvents", testDeregisterWhileProcessingEvents),

View File

@ -24,6 +24,7 @@ import XCTest
extension SocketAddressTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (SocketAddressTest) -> () throws -> Void)] {
return [
("testDescriptionWorks", testDescriptionWorks),

View File

@ -24,6 +24,7 @@ import XCTest
extension SocketChannelTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (SocketChannelTest) -> () throws -> Void)] {
return [
("testAsyncSetOption", testAsyncSetOption),

View File

@ -24,6 +24,7 @@ import XCTest
extension SocketOptionProviderTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (SocketOptionProviderTest) -> () throws -> Void)] {
return [
("testSettingAndGettingComplexSocketOption", testSettingAndGettingComplexSocketOption),

View File

@ -24,6 +24,7 @@ import XCTest
extension StreamChannelTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (StreamChannelTest) -> () throws -> Void)] {
return [
("testEchoBasic", testEchoBasic),

View File

@ -24,6 +24,7 @@ import XCTest
extension SystemTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (SystemTest) -> () throws -> Void)] {
return [
("testSystemCallWrapperPerformance", testSystemCallWrapperPerformance),

View File

@ -24,6 +24,7 @@ import XCTest
extension ThreadTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (ThreadTest) -> () throws -> Void)] {
return [
("testCurrentThreadWorks", testCurrentThreadWorks),

View File

@ -24,6 +24,7 @@ import XCTest
extension TypeAssistedChannelHandlerTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (TypeAssistedChannelHandlerTest) -> () throws -> Void)] {
return [
("testCanDefineBothInboundAndOutbound", testCanDefineBothInboundAndOutbound),

View File

@ -24,6 +24,7 @@ import XCTest
extension UtilitiesTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (UtilitiesTest) -> () throws -> Void)] {
return [
("testCoreCountWorks", testCoreCountWorks),

View File

@ -24,6 +24,7 @@ import XCTest
extension Base64Test {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (Base64Test) -> () throws -> Void)] {
return [
("testEncodeEmptyData", testEncodeEmptyData),

View File

@ -24,6 +24,7 @@ import XCTest
extension WebSocketClientEndToEndTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (WebSocketClientEndToEndTests) -> () throws -> Void)] {
return [
("testSimpleUpgradeSucceeds", testSimpleUpgradeSucceeds),

View File

@ -24,6 +24,7 @@ import XCTest
extension WebSocketFrameDecoderTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (WebSocketFrameDecoderTest) -> () throws -> Void)] {
return [
("testFramesWithoutBodies", testFramesWithoutBodies),

View File

@ -24,6 +24,7 @@ import XCTest
extension WebSocketFrameEncoderTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (WebSocketFrameEncoderTest) -> () throws -> Void)] {
return [
("testBasicFrameEncoding", testBasicFrameEncoding),

View File

@ -24,6 +24,7 @@ import XCTest
extension WebSocketServerEndToEndTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (WebSocketServerEndToEndTests) -> () throws -> Void)] {
return [
("testBasicUpgradeDance", testBasicUpgradeDance),

View File

@ -72,6 +72,7 @@ def createExtensionFile(fileName, classes)
for classArray in classes
file.write 'extension ' + classArray[0] + " {\n\n"
file.write ' @available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")' +"\n"
file.write ' static var allTests : [(String, (' + classArray[0] + ") -> () throws -> Void)] {\n"
file.write " return [\n"
@ -99,7 +100,15 @@ def createLinuxMain(testsDirectory, allTestSubDirectories, files)
file.write ' @testable import ' + testSubDirectory + "\n"
end
file.write "\n"
file.write " XCTMain([\n"
file.write "// This protocol is necessary to we can call the 'run' method (on an existential of this protocol)\n"
file.write "// without the compiler noticing that we're calling a deprecated function.\n"
file.write "// This hack exists so we can deprecate individual tests which test deprecated functionality without\n"
file.write "// getting a compiler warning...\n"
file.write "protocol LinuxMainRunner { func run() }\n"
file.write "class LinuxMainRunnerImpl: LinuxMainRunner {\n"
file.write ' @available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")' + "\n"
file.write " func run() {\n"
file.write " XCTMain([\n"
testCases = []
for classes in files
@ -109,9 +118,12 @@ def createLinuxMain(testsDirectory, allTestSubDirectories, files)
end
for testCase in testCases.sort { |x, y| x <=> y }
file.write ' testCase(' + testCase + ".allTests),\n"
file.write ' testCase(' + testCase + ".allTests),\n"
end
file.write " ])\n"
file.write " ])\n"
file.write " }\n"
file.write "}\n"
file.write "(LinuxMainRunnerImpl() as LinuxMainRunner).run()\n"
file.write "#endif\n"
end
end