Skip to content

Commit 147f7d2

Browse files
committed
Break out testSwiftTestingTestWithTags into two tests
One that tests string tags, and the other that tests static tags.
1 parent 3870fae commit 147f7d2

File tree

1 file changed

+50
-3
lines changed

1 file changed

+50
-3
lines changed

Tests/SourceKitLSPTests/DocumentTestDiscoveryTests.swift

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

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

@@ -595,7 +595,7 @@ final class DocumentTestDiscoveryTests: XCTestCase {
595595
596596
1️⃣@Suite(.tags("Suites"))
597597
struct MyTests {
598-
2️⃣@Test(.tags("one", "two", .red, .blue))
598+
2️⃣@Test(.tags("one", "two"))
599599
func oneIsTwo() {
600600
#expect(1 == 2)
601601
}3️⃣
@@ -622,7 +622,54 @@ final class DocumentTestDiscoveryTests: XCTestCase {
622622
style: TestStyle.swiftTesting,
623623
location: Location(uri: uri, range: positions["2️⃣"]..<positions["3️⃣"]),
624624
children: [],
625-
tags: [TestTag(id: "one"), TestTag(id: "two"), TestTag(id: "red"), TestTag(id: "blue")]
625+
tags: [TestTag(id: "one"), TestTag(id: "two")]
626+
)
627+
],
628+
tags: [TestTag(id: "Suites")]
629+
)
630+
]
631+
)
632+
}
633+
634+
635+
func testSwiftTestingTestWithMemberTags() async throws {
636+
let testClient = try await TestSourceKitLSPClient()
637+
let uri = DocumentURI.for(.swift)
638+
639+
let positions = testClient.openDocument(
640+
"""
641+
import Testing
642+
643+
1️⃣@Suite(.tags("Suites"))
644+
struct MyTests {
645+
2️⃣@Test(.tags(.red, .blue))
646+
func oneIsTwo() {
647+
#expect(1 == 2)
648+
}3️⃣
649+
}4️⃣
650+
""",
651+
uri: uri
652+
)
653+
654+
let tests = try await testClient.send(DocumentTestsRequest(textDocument: TextDocumentIdentifier(uri)))
655+
XCTAssertEqual(
656+
tests,
657+
[
658+
TestItem(
659+
id: "MyTests",
660+
label: "MyTests",
661+
disabled: false,
662+
style: TestStyle.swiftTesting,
663+
location: Location(uri: uri, range: positions["1️⃣"]..<positions["4️⃣"]),
664+
children: [
665+
TestItem(
666+
id: "MyTests/oneIsTwo()",
667+
label: "oneIsTwo()",
668+
disabled: false,
669+
style: TestStyle.swiftTesting,
670+
location: Location(uri: uri, range: positions["2️⃣"]..<positions["3️⃣"]),
671+
children: [],
672+
tags: [TestTag(id: "red"), TestTag(id: "blue")]
626673
)
627674
],
628675
tags: [TestTag(id: "Suites")]

0 commit comments

Comments
 (0)