From d0a99c780d6eb720ddec5e983d65c56c68d2e111 Mon Sep 17 00:00:00 2001 From: Paul LeMarquand Date: Tue, 9 Jul 2024 12:11:33 -0400 Subject: [PATCH] Add more test discovery tests Add some more tests around test discovery. Test swift testing tests found in enums, as well as the cases that exit early when looking for XCTests. --- .../DocumentTestDiscoveryTests.swift | 202 ++++++++++++++---- 1 file changed, 158 insertions(+), 44 deletions(-) diff --git a/Tests/SourceKitLSPTests/DocumentTestDiscoveryTests.swift b/Tests/SourceKitLSPTests/DocumentTestDiscoveryTests.swift index 199466337..9f89290a5 100644 --- a/Tests/SourceKitLSPTests/DocumentTestDiscoveryTests.swift +++ b/Tests/SourceKitLSPTests/DocumentTestDiscoveryTests.swift @@ -245,7 +245,7 @@ final class DocumentTestDiscoveryTests: XCTestCase { ) } - func testNestedSwiftTestingSuites() async throws { + func testSwiftTestingNestedSuites() async throws { let testClient = try await TestSourceKitLSPClient() let uri = DocumentURI(for: .swift) @@ -295,7 +295,7 @@ final class DocumentTestDiscoveryTests: XCTestCase { ) } - func testParameterizedSwiftTestingTest() async throws { + func testSwiftTestingParameterizedTest() async throws { let testClient = try await TestSourceKitLSPClient() let uri = DocumentURI(for: .swift) @@ -335,7 +335,7 @@ final class DocumentTestDiscoveryTests: XCTestCase { ) } - func testParameterizedSwiftTestingTestWithAnonymousArgument() async throws { + func testSwiftTestingParameterizedTestWithAnonymousArgument() async throws { let testClient = try await TestSourceKitLSPClient() let uri = DocumentURI(for: .swift) @@ -378,7 +378,7 @@ final class DocumentTestDiscoveryTests: XCTestCase { ) } - func testParameterizedSwiftTestingTestWithCommentInSignature() async throws { + func testSwiftTestingParameterizedTestWithCommentInSignature() async throws { let testClient = try await TestSourceKitLSPClient() let uri = DocumentURI(for: .swift) @@ -559,7 +559,7 @@ final class DocumentTestDiscoveryTests: XCTestCase { ) } - func testDisabledSwiftTestingTest() async throws { + func testSwiftTestingTestDisabledTest() async throws { let testClient = try await TestSourceKitLSPClient() let uri = DocumentURI(for: .swift) @@ -633,7 +633,7 @@ final class DocumentTestDiscoveryTests: XCTestCase { ) } - func testHiddenSwiftTestingTest() async throws { + func testSwiftTestingHiddenTest() async throws { let testClient = try await TestSourceKitLSPClient() let uri = DocumentURI(for: .swift) @@ -859,43 +859,6 @@ final class DocumentTestDiscoveryTests: XCTestCase { ) } - func testXCTestTestsWithExtension() async throws { - let testClient = try await TestSourceKitLSPClient() - let uri = DocumentURI(for: .swift) - - let positions = testClient.openDocument( - """ - import XCTest - - 1️⃣final class MyTests: XCTestCase {}2️⃣ - - extension MyTests { - 3️⃣func testOneIsTwo() {}4️⃣ - } - """, - uri: uri - ) - - let tests = try await testClient.send(DocumentTestsRequest(textDocument: TextDocumentIdentifier(uri))) - XCTAssertEqual( - tests, - [ - TestItem( - id: "MyTests", - label: "MyTests", - location: Location(uri: uri, range: positions["1️⃣"]..