@@ -386,6 +386,96 @@ final class DocumentTestDiscoveryTests: XCTestCase {
386386 )
387387 }
388388
389+ func testParameterizedSwiftTestingTestWithAnonymousArgument( ) async throws {
390+ let testClient = try await TestSourceKitLSPClient ( )
391+ let uri = DocumentURI . for ( . swift)
392+
393+ let positions = testClient. openDocument (
394+ """
395+ import Testing
396+
397+ 1️⃣struct MyTests {
398+ 2️⃣@Test(arguments: [0, 1, 2])
399+ func numbersAreOne(_ x: Int) {
400+ #expect(x == 1)
401+ }3️⃣
402+ }4️⃣
403+ """ ,
404+ uri: uri
405+ )
406+
407+ let tests = try await testClient. send ( DocumentTestsRequest ( textDocument: TextDocumentIdentifier ( uri) ) )
408+ XCTAssertEqual (
409+ tests,
410+ [
411+ TestItem (
412+ id: " MyTests " ,
413+ label: " MyTests " ,
414+ disabled: false ,
415+ style: TestStyle . swiftTesting,
416+ location: Location ( uri: uri, range: positions [ " 1️⃣ " ] ..< positions [ " 4️⃣ " ] ) ,
417+ children: [
418+ TestItem (
419+ id: " MyTests/numbersAreOne(_:) " ,
420+ label: " numbersAreOne(_:) " ,
421+ disabled: false ,
422+ style: TestStyle . swiftTesting,
423+ location: Location ( uri: uri, range: positions [ " 2️⃣ " ] ..< positions [ " 3️⃣ " ] ) ,
424+ children: [ ] ,
425+ tags: [ ]
426+ )
427+ ] ,
428+ tags: [ ]
429+ )
430+ ]
431+ )
432+ }
433+
434+ func testParameterizedSwiftTestingTestWithCommentInSignature( ) async throws {
435+ let testClient = try await TestSourceKitLSPClient ( )
436+ let uri = DocumentURI . for ( . swift)
437+
438+ let positions = testClient. openDocument (
439+ """
440+ import Testing
441+
442+ 1️⃣struct MyTests {
443+ 2️⃣@Test(arguments: [0, 1, 2])
444+ func numbersAreOne(x /* hello */: Int) {
445+ #expect(x == 1)
446+ }3️⃣
447+ }4️⃣
448+ """ ,
449+ uri: uri
450+ )
451+
452+ let tests = try await testClient. send ( DocumentTestsRequest ( textDocument: TextDocumentIdentifier ( uri) ) )
453+ XCTAssertEqual (
454+ tests,
455+ [
456+ TestItem (
457+ id: " MyTests " ,
458+ label: " MyTests " ,
459+ disabled: false ,
460+ style: TestStyle . swiftTesting,
461+ location: Location ( uri: uri, range: positions [ " 1️⃣ " ] ..< positions [ " 4️⃣ " ] ) ,
462+ children: [
463+ TestItem (
464+ id: " MyTests/numbersAreOne(x:) " ,
465+ label: " numbersAreOne(x:) " ,
466+ disabled: false ,
467+ style: TestStyle . swiftTesting,
468+ location: Location ( uri: uri, range: positions [ " 2️⃣ " ] ..< positions [ " 3️⃣ " ] ) ,
469+ children: [ ] ,
470+ tags: [ ]
471+ )
472+ ] ,
473+ tags: [ ]
474+ )
475+ ]
476+ )
477+ }
478+
389479 func testSwiftTestingSuiteWithNoTests( ) async throws {
390480 let testClient = try await TestSourceKitLSPClient ( )
391481 let uri = DocumentURI . for ( . swift)
0 commit comments