update generated test script from swift-nio (#188)

The newer version of the script automatically calculates accurate
copyright date statements.
This commit is contained in:
Rick Newton-Rogers 2022-12-02 15:17:43 +00:00 committed by GitHub
parent b89549b289
commit 54def83a52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 157 additions and 60 deletions

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2018-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -22,36 +22,47 @@ import XCTest
/// Do NOT edit this file directly as it will be regenerated automatically when needed.
///
#if os(Linux) || os(FreeBSD)
#if !compiler(>=5.5)
#if os(Linux) || os(FreeBSD) || os(Android)
@testable import NIOExtrasTests
@testable import NIOHTTPCompressionTests
@testable import NIOSOCKSTests
XCTMain([
testCase(ClientGreetingTests.allTests),
testCase(ClientRequestTests.allTests),
testCase(ClientStateMachineTests.allTests),
testCase(DebugInboundEventsHandlerTest.allTests),
testCase(DebugOutboundEventsHandlerTest.allTests),
testCase(FixedLengthFrameDecoderTest.allTests),
testCase(HTTPRequestCompressorTest.allTests),
testCase(HTTPRequestDecompressorTest.allTests),
testCase(HTTPResponseCompressorTest.allTests),
testCase(HTTPResponseDecompressorTest.allTests),
testCase(HelperTests.allTests),
testCase(JSONRPCFramingContentLengthHeaderDecoderTests.allTests),
testCase(JSONRPCFramingContentLengthHeaderEncoderTests.allTests),
testCase(LengthFieldBasedFrameDecoderTest.allTests),
testCase(LengthFieldPrependerTest.allTests),
testCase(LineBasedFrameDecoderTest.allTests),
testCase(MethodSelectionTests.allTests),
testCase(PCAPRingBufferTest.allTests),
testCase(QuiescingHelperTest.allTests),
testCase(RequestResponseHandlerTest.allTests),
testCase(SOCKSServerHandlerTests.allTests),
testCase(ServerResponseTests.allTests),
testCase(ServerStateMachineTests.allTests),
testCase(SocksClientHandlerTests.allTests),
testCase(WritePCAPHandlerTest.allTests),
])
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
@main
class LinuxMainRunner {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static func main() {
XCTMain([
testCase(ClientGreetingTests.allTests),
testCase(ClientRequestTests.allTests),
testCase(ClientStateMachineTests.allTests),
testCase(DebugInboundEventsHandlerTest.allTests),
testCase(DebugOutboundEventsHandlerTest.allTests),
testCase(FixedLengthFrameDecoderTest.allTests),
testCase(HTTPRequestCompressorTest.allTests),
testCase(HTTPRequestDecompressorTest.allTests),
testCase(HTTPResponseCompressorTest.allTests),
testCase(HTTPResponseDecompressorTest.allTests),
testCase(HelperTests.allTests),
testCase(JSONRPCFramingContentLengthHeaderDecoderTests.allTests),
testCase(JSONRPCFramingContentLengthHeaderEncoderTests.allTests),
testCase(LengthFieldBasedFrameDecoderTest.allTests),
testCase(LengthFieldPrependerTest.allTests),
testCase(LineBasedFrameDecoderTest.allTests),
testCase(MethodSelectionTests.allTests),
testCase(PCAPRingBufferTest.allTests),
testCase(QuiescingHelperTest.allTests),
testCase(RequestResponseHandlerTest.allTests),
testCase(SOCKSServerHandlerTests.allTests),
testCase(ServerResponseTests.allTests),
testCase(ServerStateMachineTests.allTests),
testCase(SocksClientHandlerTests.allTests),
testCase(WritePCAPHandlerTest.allTests),
])
}
}
#endif
#else
#error("on Swift 5.5 and newer, --enable-test-discovery is required")
#endif

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2018-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension DebugInboundEventsHandlerTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (DebugInboundEventsHandlerTest) -> () throws -> Void)] {
return [
("testRegistered", testRegistered),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2018-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension DebugOutboundEventsHandlerTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (DebugOutboundEventsHandlerTest) -> () throws -> Void)] {
return [
("testRegister", testRegister),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2018-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension FixedLengthFrameDecoderTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (FixedLengthFrameDecoderTest) -> () throws -> Void)] {
return [
("testDecodeIfFewerBytesAreSent", testDecodeIfFewerBytesAreSent),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2019-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension JSONRPCFramingContentLengthHeaderDecoderTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (JSONRPCFramingContentLengthHeaderDecoderTests) -> () throws -> Void)] {
return [
("testBasicMessage", testBasicMessage),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2018-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension JSONRPCFramingContentLengthHeaderEncoderTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (JSONRPCFramingContentLengthHeaderEncoderTests) -> () throws -> Void)] {
return [
("testEmptyMessage", testEmptyMessage),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2018-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension LengthFieldBasedFrameDecoderTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (LengthFieldBasedFrameDecoderTest) -> () throws -> Void)] {
return [
("testReadUInt32From3Bytes", testReadUInt32From3Bytes),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2019-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension LengthFieldPrependerTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (LengthFieldPrependerTest) -> () throws -> Void)] {
return [
("testWrite3BytesOfUInt32Write", testWrite3BytesOfUInt32Write),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2018-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension LineBasedFrameDecoderTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (LineBasedFrameDecoderTest) -> () throws -> Void)] {
return [
("testDecodeOneCharacterAtATime", testDecodeOneCharacterAtATime),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2018-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension PCAPRingBufferTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (PCAPRingBufferTest) -> () throws -> Void)] {
return [
("testNotLimited", testNotLimited),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2018-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension QuiescingHelperTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (QuiescingHelperTest) -> () throws -> Void)] {
return [
("testShutdownIsImmediateWhenNoChannelsCollected", testShutdownIsImmediateWhenNoChannelsCollected),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2018-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension RequestResponseHandlerTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (RequestResponseHandlerTest) -> () throws -> Void)] {
return [
("testSimpleRequestWorks", testSimpleRequestWorks),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2019-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension WritePCAPHandlerTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (WritePCAPHandlerTest) -> () throws -> Void)] {
return [
("testConnectIssuesThreePacketsForIPv4", testConnectIssuesThreePacketsForIPv4),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2020-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension HTTPRequestCompressorTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (HTTPRequestCompressorTest) -> () throws -> Void)] {
return [
("testGzipContentEncoding", testGzipContentEncoding),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2018-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension HTTPRequestDecompressorTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (HTTPRequestDecompressorTest) -> () throws -> Void)] {
return [
("testDecompressionNoLimit", testDecompressionNoLimit),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2019-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension HTTPResponseCompressorTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (HTTPResponseCompressorTest) -> () throws -> Void)] {
return [
("testCanCompressSimpleBodies", testCanCompressSimpleBodies),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2018-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension HTTPResponseDecompressorTest {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (HTTPResponseDecompressorTest) -> () throws -> Void)] {
return [
("testDecompressionNoLimit", testDecompressionNoLimit),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2018-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension ClientGreetingTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (ClientGreetingTests) -> () throws -> Void)] {
return [
("testInitFromBuffer", testInitFromBuffer),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2018-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension ClientRequestTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (ClientRequestTests) -> () throws -> Void)] {
return [
("testWriteClientRequest", testWriteClientRequest),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2018-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension ClientStateMachineTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (ClientStateMachineTests) -> () throws -> Void)] {
return [
("testUsualWorkflow", testUsualWorkflow),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2018-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension HelperTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (HelperTests) -> () throws -> Void)] {
return [
("testUnwindingReturnNil", testUnwindingReturnNil),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2018-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension MethodSelectionTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (MethodSelectionTests) -> () throws -> Void)] {
return [
("testReadFromByteBuffer", testReadFromByteBuffer),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2018-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension SOCKSServerHandlerTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (SOCKSServerHandlerTests) -> () throws -> Void)] {
return [
("testTypicalWorkflow", testTypicalWorkflow),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2018-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension ServerResponseTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (ServerResponseTests) -> () throws -> Void)] {
return [
("testServerResponseReadFromByteBuffer", testServerResponseReadFromByteBuffer),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2018-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension ServerStateMachineTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (ServerStateMachineTests) -> () throws -> Void)] {
return [
("testUsualWorkflow", testUsualWorkflow),

View File

@ -2,7 +2,7 @@
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) 2018-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -24,6 +24,7 @@ import XCTest
extension SocksClientHandlerTests {
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
static var allTests : [(String, (SocksClientHandlerTests) -> () throws -> Void)] {
return [
("testTypicalWorkflow", testTypicalWorkflow),

View File

@ -19,6 +19,7 @@
#
# Created by Tony Stone on 5/4/16.
#
require 'date'
require 'getoptlong'
require 'fileutils'
require 'pathname'
@ -28,13 +29,61 @@ include FileUtils
#
# This ruby script will auto generate LinuxMain.swift and the +XCTest.swift extension files for Swift Package Manager on Linux platforms.
#
def extractCopyright(log)
startYear = 0
endYear = 0
indices = log.enum_for(:scan, /(?=Date:)/).map do
Regexp.last_match.offset(0).first
end
# If there are no years, assume this year.
if indices.count == 0
return "#{Date.today.year}"
end
# Return one year if there is only one year
if indices.count == 1
year = log[indices[0]+27..indices[0]+31]
return "#{year}"
end
# Return a year range
indices.each_with_index do |ind, i|
year = log[ind+27..ind+31]
# Seed start year
if i == 0
startYear = Integer(year)
end
# For all other years following
if Integer(year) > endYear
endYear = Integer(year)
end
if Integer(year) < startYear
startYear = Integer(year)
end
end
# If the years end up being the same
if startYear == endYear
return "#{startYear}"
end
# Otherwise, return the year range
return "#{startYear}-#{endYear}"
end
def header(fileName)
log = %x(git log --follow -p #{fileName})
copyrightYears = extractCopyright(log).strip
string = <<-eos
//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
// Copyright (c) #{copyrightYears} Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
@ -70,6 +119,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"
@ -92,12 +142,18 @@ def createLinuxMain(testsDirectory, allTestSubDirectories, files)
file.write header(fileName)
file.write "\n"
file.write "#if os(Linux) || os(FreeBSD)\n"
file.write "#if !compiler(>=5.5)\n"
file.write "#if os(Linux) || os(FreeBSD) || os(Android)\n"
for testSubDirectory in allTestSubDirectories.sort { |x, y| x <=> y }
file.write ' @testable import ' + testSubDirectory + "\n"
end
file.write "\n"
file.write " XCTMain([\n"
file.write '@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")' + "\n"
file.write "@main\n"
file.write "class 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 " static func main() {\n"
file.write " XCTMain([\n"
testCases = []
for classes in files
@ -107,9 +163,14 @@ 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 "#endif\n"
file.write "#else\n"
file.write "#error(\"on Swift 5.5 and newer, --enable-test-discovery is required\")\n"
file.write "#endif\n"
end
end

View File

@ -18,7 +18,7 @@ here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
function replace_acceptable_years() {
# this needs to replace all acceptable forms with 'YEARS'
sed -e 's/20[12][78901]-20[12][78901]/YEARS/' -e 's/2019/YEARS/' -e 's/2020/YEARS/g' -e 's/2021/YEARS/g'
sed -e 's/20[12][789012]-20[12][789012]/YEARS/' -e 's/20[12][89012]/YEARS/'
}
printf "=> Checking linux tests... "