Skip to content

Commit 94b14f2

Browse files
authored
Tests: Migrate Test Command Tests to Swift Testing (#8835)
Migrate the Test Command Tests to Swift Testing. Make use of the parameterized tests to reduce duplication and use to get signal when tests have been fixed.
1 parent 58eb4ce commit 94b14f2

File tree

4 files changed

+1083
-609
lines changed

4 files changed

+1083
-609
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
This source file is part of the Swift.org open source project
3+
4+
Copyright (c) 2025 Apple Inc. and the Swift project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+
See http://swift.org/LICENSE.txt for license information
8+
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
*/
10+
11+
import Testing
12+
13+
extension Tag {
14+
public enum TestSize {}
15+
public enum Feature {}
16+
@Tag public static var UserWorkflow: Tag
17+
}
18+
19+
extension Tag.TestSize {
20+
@Tag public static var small: Tag
21+
@Tag public static var medium: Tag
22+
@Tag public static var large: Tag
23+
}
24+
25+
extension Tag.Feature {
26+
public enum Command {}
27+
public enum PackageType {}
28+
29+
@Tag public static var CodeCoverage: Tag
30+
@Tag public static var Resource: Tag
31+
@Tag public static var SpecialCharacters: Tag
32+
@Tag public static var Traits: Tag
33+
}
34+
35+
extension Tag.Feature.Command {
36+
public enum Package {}
37+
@Tag public static var Build: Tag
38+
@Tag public static var Test: Tag
39+
@Tag public static var Run: Tag
40+
}
41+
42+
extension Tag.Feature.Command.Package {
43+
@Tag public static var Init: Tag
44+
@Tag public static var DumpPackage: Tag
45+
@Tag public static var DumpSymbolGraph: Tag
46+
@Tag public static var Plugin: Tag
47+
}
48+
49+
extension Tag.Feature.PackageType {
50+
@Tag public static var Library: Tag
51+
@Tag public static var Executable: Tag
52+
@Tag public static var Tool: Tag
53+
@Tag public static var Plugin: Tag
54+
@Tag public static var BuildToolPlugin: Tag
55+
@Tag public static var CommandPlugin: Tag
56+
@Tag public static var Macro: Tag
57+
}

Sources/_InternalTestSupport/SkippedTestSupport.swift renamed to Sources/_InternalTestSupport/SwiftTesting+TraitConditional.swift

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -59,55 +59,3 @@ extension Trait where Self == Testing.ConditionTrait {
5959
}
6060
}
6161
}
62-
63-
extension Trait where Self == Testing.Bug {
64-
public static func SWBINTTODO(_ comment: Comment) -> Self {
65-
bug(nil, id: 0, comment)
66-
}
67-
}
68-
extension Tag {
69-
public enum TestSize {}
70-
public enum Feature {}
71-
@Tag public static var UserWorkflow: Tag
72-
}
73-
74-
extension Tag.TestSize {
75-
@Tag public static var small: Tag
76-
@Tag public static var medium: Tag
77-
@Tag public static var large: Tag
78-
}
79-
80-
extension Tag.Feature {
81-
public enum Command {}
82-
public enum PackageType {}
83-
84-
@Tag public static var CodeCoverage: Tag
85-
@Tag public static var Resource: Tag
86-
@Tag public static var SpecialCharacters: Tag
87-
@Tag public static var Traits: Tag
88-
}
89-
90-
91-
extension Tag.Feature.Command {
92-
public enum Package {}
93-
@Tag public static var Build: Tag
94-
@Tag public static var Test: Tag
95-
@Tag public static var Run: Tag
96-
}
97-
98-
99-
extension Tag.Feature.Command.Package {
100-
@Tag public static var Init: Tag
101-
@Tag public static var DumpPackage: Tag
102-
@Tag public static var DumpSymbolGraph: Tag
103-
@Tag public static var Plugin: Tag
104-
}
105-
extension Tag.Feature.PackageType {
106-
@Tag public static var Library: Tag
107-
@Tag public static var Executable: Tag
108-
@Tag public static var Tool: Tag
109-
@Tag public static var Plugin: Tag
110-
@Tag public static var BuildToolPlugin: Tag
111-
@Tag public static var CommandPlugin: Tag
112-
@Tag public static var Macro: Tag
113-
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
This source file is part of the Swift.org open source project
3+
4+
Copyright (c) 2025 Apple Inc. and the Swift project authors
5+
Licensed under Apache License v2.0 with Runtime Library Exception
6+
7+
See http://swift.org/LICENSE.txt for license information
8+
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
*/
10+
11+
import Testing
12+
13+
extension Trait where Self == Testing.Bug {
14+
public static func SWBINTTODO(_ comment: Comment) -> Self {
15+
bug(nil, id: 0, comment)
16+
}
17+
}
18+
19+
public enum Relationship {
20+
case verifies
21+
case defect
22+
case fixedBy
23+
}
24+
25+
extension Trait where Self == Testing.Bug {
26+
public static func issue(
27+
_ issue: _const String,
28+
relationship: Relationship,
29+
) -> Self {
30+
bug(nil, id: 0, "\(relationship): \(issue)")
31+
}
32+
}

0 commit comments

Comments
 (0)