@@ -245,7 +245,7 @@ final class DocumentTestDiscoveryTests: XCTestCase {
245
245
)
246
246
}
247
247
248
- func testNestedSwiftTestingSuites ( ) async throws {
248
+ func testSwiftTestingNestedSuites ( ) async throws {
249
249
let testClient = try await TestSourceKitLSPClient ( )
250
250
let uri = DocumentURI ( for: . swift)
251
251
@@ -295,7 +295,7 @@ final class DocumentTestDiscoveryTests: XCTestCase {
295
295
)
296
296
}
297
297
298
- func testParameterizedSwiftTestingTest ( ) async throws {
298
+ func testSwiftTestingParameterizedTest ( ) async throws {
299
299
let testClient = try await TestSourceKitLSPClient ( )
300
300
let uri = DocumentURI ( for: . swift)
301
301
@@ -335,7 +335,7 @@ final class DocumentTestDiscoveryTests: XCTestCase {
335
335
)
336
336
}
337
337
338
- func testParameterizedSwiftTestingTestWithAnonymousArgument ( ) async throws {
338
+ func testSwiftTestingParameterizedTestWithAnonymousArgument ( ) async throws {
339
339
let testClient = try await TestSourceKitLSPClient ( )
340
340
let uri = DocumentURI ( for: . swift)
341
341
@@ -378,7 +378,7 @@ final class DocumentTestDiscoveryTests: XCTestCase {
378
378
)
379
379
}
380
380
381
- func testParameterizedSwiftTestingTestWithCommentInSignature ( ) async throws {
381
+ func testSwiftTestingParameterizedTestWithCommentInSignature ( ) async throws {
382
382
let testClient = try await TestSourceKitLSPClient ( )
383
383
let uri = DocumentURI ( for: . swift)
384
384
@@ -559,7 +559,7 @@ final class DocumentTestDiscoveryTests: XCTestCase {
559
559
)
560
560
}
561
561
562
- func testDisabledSwiftTestingTest ( ) async throws {
562
+ func testSwiftTestingTestDisabledTest ( ) async throws {
563
563
let testClient = try await TestSourceKitLSPClient ( )
564
564
let uri = DocumentURI ( for: . swift)
565
565
@@ -633,7 +633,7 @@ final class DocumentTestDiscoveryTests: XCTestCase {
633
633
)
634
634
}
635
635
636
- func testHiddenSwiftTestingTest ( ) async throws {
636
+ func testSwiftTestingHiddenTest ( ) async throws {
637
637
let testClient = try await TestSourceKitLSPClient ( )
638
638
let uri = DocumentURI ( for: . swift)
639
639
@@ -859,43 +859,6 @@ final class DocumentTestDiscoveryTests: XCTestCase {
859
859
)
860
860
}
861
861
862
- func testXCTestTestsWithExtension( ) async throws {
863
- let testClient = try await TestSourceKitLSPClient ( )
864
- let uri = DocumentURI ( for: . swift)
865
-
866
- let positions = testClient. openDocument (
867
- """
868
- import XCTest
869
-
870
- 1️⃣final class MyTests: XCTestCase {}2️⃣
871
-
872
- extension MyTests {
873
- 3️⃣func testOneIsTwo() {}4️⃣
874
- }
875
- """ ,
876
- uri: uri
877
- )
878
-
879
- let tests = try await testClient. send ( DocumentTestsRequest ( textDocument: TextDocumentIdentifier ( uri) ) )
880
- XCTAssertEqual (
881
- tests,
882
- [
883
- TestItem (
884
- id: " MyTests " ,
885
- label: " MyTests " ,
886
- location: Location ( uri: uri, range: positions [ " 1️⃣ " ] ..< positions [ " 2️⃣ " ] ) ,
887
- children: [
888
- TestItem (
889
- id: " MyTests/testOneIsTwo() " ,
890
- label: " testOneIsTwo() " ,
891
- location: Location ( uri: uri, range: positions [ " 3️⃣ " ] ..< positions [ " 4️⃣ " ] )
892
- )
893
- ]
894
- )
895
- ]
896
- )
897
- }
898
-
899
862
func testSwiftTestingNestedTestSuiteWithExtension( ) async throws {
900
863
let testClient = try await TestSourceKitLSPClient ( )
901
864
let uri = DocumentURI ( for: . swift)
@@ -1086,7 +1049,87 @@ final class DocumentTestDiscoveryTests: XCTestCase {
1086
1049
)
1087
1050
}
1088
1051
1089
- func testFullyQualifySwiftTestingTestAttribute( ) async throws {
1052
+ func testSwiftTestingEnumSuite( ) async throws {
1053
+ let testClient = try await TestSourceKitLSPClient ( )
1054
+ let uri = DocumentURI ( for: . swift)
1055
+
1056
+ let positions = testClient. openDocument (
1057
+ """
1058
+ import Testing
1059
+
1060
+ 1️⃣enum MyTests {
1061
+ 2️⃣@Test
1062
+ static func oneIsTwo() {
1063
+ #expect(1 == 2)
1064
+ }3️⃣
1065
+ }4️⃣
1066
+ """ ,
1067
+ uri: uri
1068
+ )
1069
+
1070
+ let tests = try await testClient. send ( DocumentTestsRequest ( textDocument: TextDocumentIdentifier ( uri) ) )
1071
+ XCTAssertEqual (
1072
+ tests,
1073
+ [
1074
+ TestItem (
1075
+ id: " MyTests " ,
1076
+ label: " MyTests " ,
1077
+ style: TestStyle . swiftTesting,
1078
+ location: Location ( uri: uri, range: positions [ " 1️⃣ " ] ..< positions [ " 4️⃣ " ] ) ,
1079
+ children: [
1080
+ TestItem (
1081
+ id: " MyTests/oneIsTwo() " ,
1082
+ label: " oneIsTwo() " ,
1083
+ style: TestStyle . swiftTesting,
1084
+ location: Location ( uri: uri, range: positions [ " 2️⃣ " ] ..< positions [ " 3️⃣ " ] )
1085
+ )
1086
+ ]
1087
+ )
1088
+ ]
1089
+ )
1090
+ }
1091
+
1092
+ func testSwiftTestingActorSuite( ) async throws {
1093
+ let testClient = try await TestSourceKitLSPClient ( )
1094
+ let uri = DocumentURI ( for: . swift)
1095
+
1096
+ let positions = testClient. openDocument (
1097
+ """
1098
+ import Testing
1099
+
1100
+ 1️⃣actor MyTests {
1101
+ 2️⃣@Test
1102
+ static func oneIsTwo() {
1103
+ #expect(1 == 2)
1104
+ }3️⃣
1105
+ }4️⃣
1106
+ """ ,
1107
+ uri: uri
1108
+ )
1109
+
1110
+ let tests = try await testClient. send ( DocumentTestsRequest ( textDocument: TextDocumentIdentifier ( uri) ) )
1111
+ XCTAssertEqual (
1112
+ tests,
1113
+ [
1114
+ TestItem (
1115
+ id: " MyTests " ,
1116
+ label: " MyTests " ,
1117
+ style: TestStyle . swiftTesting,
1118
+ location: Location ( uri: uri, range: positions [ " 1️⃣ " ] ..< positions [ " 4️⃣ " ] ) ,
1119
+ children: [
1120
+ TestItem (
1121
+ id: " MyTests/oneIsTwo() " ,
1122
+ label: " oneIsTwo() " ,
1123
+ style: TestStyle . swiftTesting,
1124
+ location: Location ( uri: uri, range: positions [ " 2️⃣ " ] ..< positions [ " 3️⃣ " ] )
1125
+ )
1126
+ ]
1127
+ )
1128
+ ]
1129
+ )
1130
+ }
1131
+
1132
+ func testSwiftTestingFullyQualifyTestAttribute( ) async throws {
1090
1133
let testClient = try await TestSourceKitLSPClient ( )
1091
1134
let uri = DocumentURI ( for: . swift)
1092
1135
@@ -1127,6 +1170,77 @@ final class DocumentTestDiscoveryTests: XCTestCase {
1127
1170
)
1128
1171
}
1129
1172
1173
+ func testXCTestTestsWithExtension( ) async throws {
1174
+ let testClient = try await TestSourceKitLSPClient ( )
1175
+ let uri = DocumentURI ( for: . swift)
1176
+
1177
+ let positions = testClient. openDocument (
1178
+ """
1179
+ import XCTest
1180
+
1181
+ 1️⃣final class MyTests: XCTestCase {}2️⃣
1182
+
1183
+ extension MyTests {
1184
+ 3️⃣func testOneIsTwo() {}4️⃣
1185
+ }
1186
+ """ ,
1187
+ uri: uri
1188
+ )
1189
+
1190
+ let tests = try await testClient. send ( DocumentTestsRequest ( textDocument: TextDocumentIdentifier ( uri) ) )
1191
+ XCTAssertEqual (
1192
+ tests,
1193
+ [
1194
+ TestItem (
1195
+ id: " MyTests " ,
1196
+ label: " MyTests " ,
1197
+ location: Location ( uri: uri, range: positions [ " 1️⃣ " ] ..< positions [ " 2️⃣ " ] ) ,
1198
+ children: [
1199
+ TestItem (
1200
+ id: " MyTests/testOneIsTwo() " ,
1201
+ label: " testOneIsTwo() " ,
1202
+ location: Location ( uri: uri, range: positions [ " 3️⃣ " ] ..< positions [ " 4️⃣ " ] )
1203
+ )
1204
+ ]
1205
+ )
1206
+ ]
1207
+ )
1208
+ }
1209
+
1210
+ func testXCTestInvalidXCTestSuiteConstructions( ) async throws {
1211
+ let testClient = try await TestSourceKitLSPClient ( )
1212
+ let uri = DocumentURI ( for: . swift)
1213
+
1214
+ let positions = testClient. openDocument (
1215
+ """
1216
+ import XCTest
1217
+
1218
+ // This comment contains the string XCTestCase
1219
+ final class NSObjectInheritance: NSObject {}
1220
+ final class BaseClass {}
1221
+ final class MyEmptyTests: BaseClass {}
1222
+ 1️⃣final class MyTests: XCTestCase {
1223
+ static func testStaticFuncIsNotATest() {}
1224
+ }2️⃣
1225
+ """ ,
1226
+ uri: uri
1227
+ )
1228
+
1229
+ let tests = try await testClient. send ( DocumentTestsRequest ( textDocument: TextDocumentIdentifier ( uri) ) )
1230
+
1231
+ XCTAssertEqual (
1232
+ tests,
1233
+ [
1234
+ TestItem (
1235
+ id: " MyTests " ,
1236
+ label: " MyTests " ,
1237
+ location: Location ( uri: uri, range: positions [ " 1️⃣ " ] ..< positions [ " 2️⃣ " ] ) ,
1238
+ children: [ ]
1239
+ )
1240
+ ]
1241
+ )
1242
+ }
1243
+
1130
1244
func testAddNewMethodToNotQuiteTestCase( ) async throws {
1131
1245
let project = try await IndexedSingleSwiftFileTestProject (
1132
1246
"""
0 commit comments