Skip to content

Commit 6f850ab

Browse files
committed
Update tag tests
1 parent ef4c7fb commit 6f850ab

File tree

2 files changed

+2
-57
lines changed

2 files changed

+2
-57
lines changed

Sources/SourceKitLSP/Swift/SwiftTestingScanner.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ fileprivate extension MemberAccessExprSyntax {
364364
} else if let baseMemberAccessExpr = base?.as(MemberAccessExprSyntax.self) {
365365
return baseMemberAccessExpr.components + [declName.baseName.text]
366366
}
367+
return [declName.baseName.text]
367368
}
368369
}
369370

Tests/SourceKitLSPTests/DocumentTestDiscoveryTests.swift

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ final class DocumentTestDiscoveryTests: XCTestCase {
585585
)
586586
}
587587

588-
func testSwiftTestingTestWithStringTags() async throws {
588+
func testSwiftTestingTestWithTags() async throws {
589589
let testClient = try await TestSourceKitLSPClient()
590590
let uri = DocumentURI.for(.swift)
591591

@@ -693,62 +693,6 @@ final class DocumentTestDiscoveryTests: XCTestCase {
693693
)
694694
}
695695

696-
func testSwiftTestingTestWithCustomTags() async throws {
697-
let testClient = try await TestSourceKitLSPClient()
698-
let uri = DocumentURI.for(.swift)
699-
700-
let positions = testClient.openDocument(
701-
"""
702-
import Testing
703-
704-
extension Tag {
705-
@Tag static var foo: Self
706-
@Tag static var bar: Self
707-
@Tag static var baz: Self
708-
709-
struct Nested {
710-
@Tag static var foo: Tag
711-
}
712-
}
713-
714-
1️⃣@Suite(.tags("Suites"))
715-
struct MyTests {
716-
2️⃣@Test(.tags(.foo, Nested.foo, Testing.Tag.bar, Tag.baz))
717-
func oneIsTwo() {
718-
#expect(1 == 2)
719-
}3️⃣
720-
}4️⃣
721-
""",
722-
uri: uri
723-
)
724-
725-
let tests = try await testClient.send(DocumentTestsRequest(textDocument: TextDocumentIdentifier(uri)))
726-
XCTAssertEqual(
727-
tests,
728-
[
729-
TestItem(
730-
id: "MyTests",
731-
label: "MyTests",
732-
disabled: false,
733-
style: TestStyle.swiftTesting,
734-
location: Location(uri: uri, range: positions["1️⃣"]..<positions["4️⃣"]),
735-
children: [
736-
TestItem(
737-
id: "MyTests/oneIsTwo()",
738-
label: "oneIsTwo()",
739-
disabled: false,
740-
style: TestStyle.swiftTesting,
741-
location: Location(uri: uri, range: positions["2️⃣"]..<positions["3️⃣"]),
742-
children: [],
743-
tags: [TestTag(id: "foo"), TestTag(id: "Nested.foo"), TestTag(id: "bar"), TestTag(id: "baz")]
744-
)
745-
],
746-
tags: [TestTag(id: "Suites")]
747-
)
748-
]
749-
)
750-
}
751-
752696
func testSwiftTestingTestsWithExtension() async throws {
753697
let testClient = try await TestSourceKitLSPClient()
754698
let uri = DocumentURI.for(.swift)

0 commit comments

Comments
 (0)