@@ -177,13 +177,9 @@ final class SyntacticSwiftTestingTestScanner: SyntaxVisitor {
177
177
private let parentTypeNames : [ String ]
178
178
179
179
/// The discovered test items.
180
- private var result : [ AnnotatedTestItem ] = [ ]
180
+ private var result : [ TestItem ] = [ ]
181
181
182
- private init (
183
- snapshot: DocumentSnapshot ,
184
- allTestsDisabled: Bool ,
185
- parentTypeNames: [ String ]
186
- ) {
182
+ private init ( snapshot: DocumentSnapshot , allTestsDisabled: Bool , parentTypeNames: [ String ] ) {
187
183
self . snapshot = snapshot
188
184
self . allTestsDisabled = allTestsDisabled
189
185
self . parentTypeNames = parentTypeNames
@@ -194,7 +190,7 @@ final class SyntacticSwiftTestingTestScanner: SyntaxVisitor {
194
190
public static func findTestSymbols(
195
191
in snapshot: DocumentSnapshot ,
196
192
syntaxTreeManager: SyntaxTreeManager
197
- ) async -> [ AnnotatedTestItem ] {
193
+ ) async -> [ TestItem ] {
198
194
guard snapshot. text. contains ( " Suite " ) || snapshot. text. contains ( " Test " ) else {
199
195
// If the file contains swift-testing tests, it must contain a `@Suite` or `@Test` attribute.
200
196
// Only check for the attribute name because the attribute may be module qualified and contain an arbitrary amount
@@ -203,11 +199,7 @@ final class SyntacticSwiftTestingTestScanner: SyntaxVisitor {
203
199
return [ ]
204
200
}
205
201
let syntaxTree = await syntaxTreeManager. syntaxTree ( for: snapshot)
206
- let visitor = SyntacticSwiftTestingTestScanner (
207
- snapshot: snapshot,
208
- allTestsDisabled: false ,
209
- parentTypeNames: [ ]
210
- )
202
+ let visitor = SyntacticSwiftTestingTestScanner ( snapshot: snapshot, allTestsDisabled: false , parentTypeNames: [ ] )
211
203
visitor. walk ( syntaxTree)
212
204
return visitor. result
213
205
}
@@ -249,18 +241,14 @@ final class SyntacticSwiftTestingTestScanner: SyntaxVisitor {
249
241
}
250
242
251
243
let range = snapshot. range ( of: node. positionAfterSkippingLeadingTrivia..< node. endPositionBeforeTrailingTrivia)
252
- // Members won't be extensions since extensions will only be at the top level.
253
- let testItem = AnnotatedTestItem (
254
- testItem: TestItem (
255
- id: ( parentTypeNames + typeNames) . joined ( separator: " / " ) ,
256
- label: attributeData? . displayName ?? typeNames. last!,
257
- disabled: ( attributeData? . isDisabled ?? false ) || allTestsDisabled,
258
- style: TestStyle . swiftTesting,
259
- location: Location ( uri: snapshot. uri, range: range) ,
260
- children: memberScanner. result. map ( \. testItem) ,
261
- tags: attributeData? . tags. map ( TestTag . init ( id: ) ) ?? [ ]
262
- ) ,
263
- isExtension: node. is ( ExtensionDeclSyntax . self)
244
+ let testItem = TestItem (
245
+ id: ( parentTypeNames + typeNames) . joined ( separator: " / " ) ,
246
+ label: attributeData? . displayName ?? typeNames. last!,
247
+ disabled: ( attributeData? . isDisabled ?? false ) || allTestsDisabled,
248
+ style: TestStyle . swiftTesting,
249
+ location: Location ( uri: snapshot. uri, range: range) ,
250
+ children: memberScanner. result,
251
+ tags: attributeData? . tags. map ( TestTag . init ( id: ) ) ?? [ ]
264
252
)
265
253
result. append ( testItem)
266
254
return . skipChildren
@@ -307,17 +295,14 @@ final class SyntacticSwiftTestingTestScanner: SyntaxVisitor {
307
295
node. name. text + " ( " + node. signature. parameterClause. parameters. map { " \( $0. firstName. text) : " } . joined ( ) + " ) "
308
296
309
297
let range = snapshot. range ( of: node. positionAfterSkippingLeadingTrivia..< node. endPositionBeforeTrailingTrivia)
310
- let testItem = AnnotatedTestItem (
311
- testItem: TestItem (
312
- id: ( parentTypeNames + [ name] ) . joined ( separator: " / " ) ,
313
- label: attributeData. displayName ?? name,
314
- disabled: attributeData. isDisabled || allTestsDisabled,
315
- style: TestStyle . swiftTesting,
316
- location: Location ( uri: snapshot. uri, range: range) ,
317
- children: [ ] ,
318
- tags: attributeData. tags. map ( TestTag . init ( id: ) )
319
- ) ,
320
- isExtension: false
298
+ let testItem = TestItem (
299
+ id: ( parentTypeNames + [ name] ) . joined ( separator: " / " ) ,
300
+ label: attributeData. displayName ?? name,
301
+ disabled: attributeData. isDisabled || allTestsDisabled,
302
+ style: TestStyle . swiftTesting,
303
+ location: Location ( uri: snapshot. uri, range: range) ,
304
+ children: [ ] ,
305
+ tags: attributeData. tags. map ( TestTag . init ( id: ) )
321
306
)
322
307
result. append ( testItem)
323
308
return . visitChildren
0 commit comments