From 6c568da113a7abe712e4a00883a85ff7745d6929 Mon Sep 17 00:00:00 2001 From: Adam Fowler Date: Wed, 11 Sep 2024 09:26:11 +0100 Subject: [PATCH] Make all XCTestCase classses final to stop swift 6 compiler complaining (#547) --- Tests/HummingbirdCoreTests/CoreTests.swift | 2 +- Tests/HummingbirdCoreTests/HTTP2Tests.swift | 2 +- Tests/HummingbirdCoreTests/TLSTests.swift | 2 +- Tests/HummingbirdCoreTests/TSTests.swift | 2 +- Tests/HummingbirdTests/CookiesTests.swift | 2 +- Tests/HummingbirdTests/DateCacheTests.swift | 2 +- Tests/HummingbirdTests/FileIOTests.swift | 2 +- Tests/HummingbirdTests/FileMiddlewareTests.swift | 2 +- Tests/HummingbirdTests/HTTPTests.swift | 2 +- Tests/HummingbirdTests/HummingBirdJSONTests.swift | 2 +- Tests/HummingbirdTests/TrieRouterTests.swift | 2 +- .../URLEncodedForm/Application+URLEncodedFormTests.swift | 2 +- Tests/HummingbirdTests/URLEncodedForm/URLDecoderTests.swift | 2 +- Tests/HummingbirdTests/URLEncodedForm/URLEncodedNodeTests.swift | 2 +- Tests/HummingbirdTests/URLEncodedForm/URLEncoderTests.swift | 2 +- Tests/HummingbirdTests/UtilsTests.swift | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Tests/HummingbirdCoreTests/CoreTests.swift b/Tests/HummingbirdCoreTests/CoreTests.swift index 9ab463a3e..e2e2ffdde 100644 --- a/Tests/HummingbirdCoreTests/CoreTests.swift +++ b/Tests/HummingbirdCoreTests/CoreTests.swift @@ -24,7 +24,7 @@ import NIOPosix import ServiceLifecycle import XCTest -class HummingBirdCoreTests: XCTestCase { +final class HummingBirdCoreTests: XCTestCase { static let eventLoopGroup: EventLoopGroup = { #if os(iOS) NIOTSEventLoopGroup.singleton diff --git a/Tests/HummingbirdCoreTests/HTTP2Tests.swift b/Tests/HummingbirdCoreTests/HTTP2Tests.swift index 33e051c10..ff9e30a5c 100644 --- a/Tests/HummingbirdCoreTests/HTTP2Tests.swift +++ b/Tests/HummingbirdCoreTests/HTTP2Tests.swift @@ -24,7 +24,7 @@ import NIOSSL import NIOTransportServices import XCTest -class HummingBirdHTTP2Tests: XCTestCase { +final class HummingBirdHTTP2Tests: XCTestCase { func testConnect() async throws { let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 2) defer { XCTAssertNoThrow(try eventLoopGroup.syncShutdownGracefully()) } diff --git a/Tests/HummingbirdCoreTests/TLSTests.swift b/Tests/HummingbirdCoreTests/TLSTests.swift index 5ebc1b7bc..c4b8885c3 100644 --- a/Tests/HummingbirdCoreTests/TLSTests.swift +++ b/Tests/HummingbirdCoreTests/TLSTests.swift @@ -23,7 +23,7 @@ import NIOSSL import NIOTransportServices import XCTest -class HummingBirdTLSTests: XCTestCase { +final class HummingBirdTLSTests: XCTestCase { func testConnect() async throws { let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 2) defer { XCTAssertNoThrow(try eventLoopGroup.syncShutdownGracefully()) } diff --git a/Tests/HummingbirdCoreTests/TSTests.swift b/Tests/HummingbirdCoreTests/TSTests.swift index 25bc04ecb..c6a0c3ae3 100644 --- a/Tests/HummingbirdCoreTests/TSTests.swift +++ b/Tests/HummingbirdCoreTests/TSTests.swift @@ -23,7 +23,7 @@ import NIOSSL import NIOTransportServices import XCTest -class TransportServicesTests: XCTestCase { +final class TransportServicesTests: XCTestCase { func randomBuffer(size: Int) -> ByteBuffer { var data = [UInt8](repeating: 0, count: size) data = data.map { _ in UInt8.random(in: 0...255) } diff --git a/Tests/HummingbirdTests/CookiesTests.swift b/Tests/HummingbirdTests/CookiesTests.swift index c3b531360..b78e59380 100644 --- a/Tests/HummingbirdTests/CookiesTests.swift +++ b/Tests/HummingbirdTests/CookiesTests.swift @@ -16,7 +16,7 @@ import HummingbirdTesting import XCTest -class CookieTests: XCTestCase { +final class CookieTests: XCTestCase { func testNameValue() { let cookie = Cookie(from: "name=value") XCTAssertEqual(cookie?.name, "name") diff --git a/Tests/HummingbirdTests/DateCacheTests.swift b/Tests/HummingbirdTests/DateCacheTests.swift index 5c0a17d02..ddd425b5d 100644 --- a/Tests/HummingbirdTests/DateCacheTests.swift +++ b/Tests/HummingbirdTests/DateCacheTests.swift @@ -17,7 +17,7 @@ import Foundation import HummingbirdTesting import XCTest -class HummingbirdDateTests: XCTestCase { +final class HummingbirdDateTests: XCTestCase { func testRFC1123Renderer() { let formatter = DateFormatter() formatter.locale = Locale(identifier: "en_US_POSIX") diff --git a/Tests/HummingbirdTests/FileIOTests.swift b/Tests/HummingbirdTests/FileIOTests.swift index c5b63a853..10dd25357 100644 --- a/Tests/HummingbirdTests/FileIOTests.swift +++ b/Tests/HummingbirdTests/FileIOTests.swift @@ -16,7 +16,7 @@ import Hummingbird import HummingbirdTesting import XCTest -class FileIOTests: XCTestCase { +final class FileIOTests: XCTestCase { static func randomBuffer(size: Int) -> ByteBuffer { var data = [UInt8](repeating: 0, count: size) data = data.map { _ in UInt8.random(in: 0...255) } diff --git a/Tests/HummingbirdTests/FileMiddlewareTests.swift b/Tests/HummingbirdTests/FileMiddlewareTests.swift index e65810669..e7edb39e6 100644 --- a/Tests/HummingbirdTests/FileMiddlewareTests.swift +++ b/Tests/HummingbirdTests/FileMiddlewareTests.swift @@ -18,7 +18,7 @@ import Hummingbird import HummingbirdTesting import XCTest -class FileMiddlewareTests: XCTestCase { +final class FileMiddlewareTests: XCTestCase { static func randomBuffer(size: Int) -> ByteBuffer { var data = [UInt8](repeating: 0, count: size) data = data.map { _ in UInt8.random(in: 0...255) } diff --git a/Tests/HummingbirdTests/HTTPTests.swift b/Tests/HummingbirdTests/HTTPTests.swift index 0d1cf29c2..7635a072b 100644 --- a/Tests/HummingbirdTests/HTTPTests.swift +++ b/Tests/HummingbirdTests/HTTPTests.swift @@ -16,7 +16,7 @@ import Hummingbird import HummingbirdCore import XCTest -class HTTPTests: XCTestCase { +final class HTTPTests: XCTestCase { func testURI(_ uri: URI, _ component: KeyPath, _ value: T) { XCTAssertEqual(uri[keyPath: component], value) } diff --git a/Tests/HummingbirdTests/HummingBirdJSONTests.swift b/Tests/HummingbirdTests/HummingBirdJSONTests.swift index 93fc15286..1f3270bff 100644 --- a/Tests/HummingbirdTests/HummingBirdJSONTests.swift +++ b/Tests/HummingbirdTests/HummingBirdJSONTests.swift @@ -17,7 +17,7 @@ import HummingbirdTesting import Logging import XCTest -class HummingbirdJSONTests: XCTestCase { +final class HummingbirdJSONTests: XCTestCase { struct User: ResponseCodable { let name: String let email: String diff --git a/Tests/HummingbirdTests/TrieRouterTests.swift b/Tests/HummingbirdTests/TrieRouterTests.swift index 5cdc9e4e3..329bdc214 100644 --- a/Tests/HummingbirdTests/TrieRouterTests.swift +++ b/Tests/HummingbirdTests/TrieRouterTests.swift @@ -15,7 +15,7 @@ @testable @_spi(Internal) import Hummingbird import XCTest -class TrieRouterTests: XCTestCase { +final class TrieRouterTests: XCTestCase { func testPathComponentsTrie() { let trieBuilder = RouterPathTrieBuilder() trieBuilder.addEntry("/usr/local/bin", value: "test1") diff --git a/Tests/HummingbirdTests/URLEncodedForm/Application+URLEncodedFormTests.swift b/Tests/HummingbirdTests/URLEncodedForm/Application+URLEncodedFormTests.swift index 4245ba3b0..2cb589f11 100644 --- a/Tests/HummingbirdTests/URLEncodedForm/Application+URLEncodedFormTests.swift +++ b/Tests/HummingbirdTests/URLEncodedForm/Application+URLEncodedFormTests.swift @@ -18,7 +18,7 @@ import Logging import NIOCore import XCTest -class HummingBirdURLEncodedTests: XCTestCase { +final class HummingBirdURLEncodedTests: XCTestCase { struct User: ResponseCodable { let name: String let email: String diff --git a/Tests/HummingbirdTests/URLEncodedForm/URLDecoderTests.swift b/Tests/HummingbirdTests/URLEncodedForm/URLDecoderTests.swift index 3768aa1ee..8da4f379b 100644 --- a/Tests/HummingbirdTests/URLEncodedForm/URLDecoderTests.swift +++ b/Tests/HummingbirdTests/URLEncodedForm/URLDecoderTests.swift @@ -15,7 +15,7 @@ @testable import Hummingbird import XCTest -class URLDecodedFormDecoderTests: XCTestCase { +final class URLDecodedFormDecoderTests: XCTestCase { func testForm(_ value: Input, query: String, decoder: URLEncodedFormDecoder = .init()) { do { let value2 = try decoder.decode(Input.self, from: query) diff --git a/Tests/HummingbirdTests/URLEncodedForm/URLEncodedNodeTests.swift b/Tests/HummingbirdTests/URLEncodedForm/URLEncodedNodeTests.swift index 33df91e69..c9c51f927 100644 --- a/Tests/HummingbirdTests/URLEncodedForm/URLEncodedNodeTests.swift +++ b/Tests/HummingbirdTests/URLEncodedForm/URLEncodedNodeTests.swift @@ -15,7 +15,7 @@ @testable import Hummingbird import XCTest -class URLEncodedFormNodeTests: XCTestCase { +final class URLEncodedFormNodeTests: XCTestCase { static func XCTAssertEncodedEqual(_ lhs: String, _ rhs: String) { let lhs = lhs.split(separator: "&") .sorted { $0 < $1 } diff --git a/Tests/HummingbirdTests/URLEncodedForm/URLEncoderTests.swift b/Tests/HummingbirdTests/URLEncodedForm/URLEncoderTests.swift index 71bae7c58..4f638d2f2 100644 --- a/Tests/HummingbirdTests/URLEncodedForm/URLEncoderTests.swift +++ b/Tests/HummingbirdTests/URLEncodedForm/URLEncoderTests.swift @@ -15,7 +15,7 @@ import Hummingbird import XCTest -class URLEncodedFormEncoderTests: XCTestCase { +final class URLEncodedFormEncoderTests: XCTestCase { static func XCTAssertEncodedEqual(_ lhs: String, _ rhs: String) { let lhs = lhs.split(separator: "&") .sorted { $0 < $1 } diff --git a/Tests/HummingbirdTests/UtilsTests.swift b/Tests/HummingbirdTests/UtilsTests.swift index f1e94992e..a4aea091d 100644 --- a/Tests/HummingbirdTests/UtilsTests.swift +++ b/Tests/HummingbirdTests/UtilsTests.swift @@ -15,7 +15,7 @@ import HummingbirdCore import XCTest -class FlatDictionaryTests: XCTestCase { +final class FlatDictionaryTests: XCTestCase { func testLiteralInit() { let a: FlatDictionary = ["test": "value", "key2": "value2"] XCTAssertEqual(a["test"], "value")