Skip to content

Commit a770f27

Browse files
committed
Promote Issue Handling Traits to public API
1 parent 0022e29 commit a770f27

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

Sources/Testing/Testing.docc/Traits.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,10 @@ types that customize the behavior of your tests.
4848
- ``Trait/bug(_:id:_:)-10yf5``
4949
- ``Trait/bug(_:id:_:)-3vtpl``
5050

51-
<!--
5251
### Handling issues
5352

5453
- ``Trait/compactMapIssues(_:)``
5554
- ``Trait/filterIssues(_:)``
56-
-->
5755

5856
### Creating custom traits
5957

@@ -67,8 +65,8 @@ types that customize the behavior of your tests.
6765
- ``Bug``
6866
- ``Comment``
6967
- ``ConditionTrait``
68+
- ``IssueHandlingTrait``
7069
- ``ParallelizationTrait``
7170
- ``Tag``
7271
- ``Tag/List``
7372
- ``TimeLimitTrait``
74-
<!--- ``IssueHandlingTrait``-->

Sources/Testing/Traits/IssueHandlingTrait.swift

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
///
2525
/// - ``Trait/compactMapIssues(_:)``
2626
/// - ``Trait/filterIssues(_:)``
27-
@_spi(Experimental)
27+
///
28+
/// @Metadata {
29+
/// @Available(Swift, introduced: 6.2)
30+
/// }
2831
public struct IssueHandlingTrait: TestTrait, SuiteTrait {
2932
/// A function which handles an issue and returns an optional replacement.
3033
///
@@ -49,6 +52,10 @@ public struct IssueHandlingTrait: TestTrait, SuiteTrait {
4952
///
5053
/// - Returns: An issue to replace `issue`, or else `nil` if the issue should
5154
/// not be recorded.
55+
///
56+
/// @Metadata {
57+
/// @Available(Swift, introduced: 6.2)
58+
/// }
5259
public func handleIssue(_ issue: Issue) -> Issue? {
5360
_handler(issue)
5461
}
@@ -58,6 +65,9 @@ public struct IssueHandlingTrait: TestTrait, SuiteTrait {
5865
}
5966
}
6067

68+
/// @Metadata {
69+
/// @Available(Swift, introduced: 6.2)
70+
/// }
6171
extension IssueHandlingTrait: TestScoping {
6272
public func scopeProvider(for test: Test, testCase: Test.Case?) -> Self? {
6373
// Provide scope for tests at both the suite and test case levels, but not
@@ -126,7 +136,6 @@ extension IssueHandlingTrait: TestScoping {
126136
}
127137
}
128138

129-
@_spi(Experimental)
130139
extension Trait where Self == IssueHandlingTrait {
131140
/// Constructs an trait that transforms issues recorded by a test.
132141
///
@@ -158,6 +167,10 @@ extension Trait where Self == IssueHandlingTrait {
158167
/// - Note: `transform` will never be passed an issue for which the value of
159168
/// ``Issue/kind`` is ``Issue/Kind/system``, and may not return such an
160169
/// issue.
170+
///
171+
/// @Metadata {
172+
/// @Available(Swift, introduced: 6.2)
173+
/// }
161174
public static func compactMapIssues(_ transform: @escaping @Sendable (Issue) -> Issue?) -> Self {
162175
Self(handler: transform)
163176
}
@@ -192,6 +205,10 @@ extension Trait where Self == IssueHandlingTrait {
192205
///
193206
/// - Note: `isIncluded` will never be passed an issue for which the value of
194207
/// ``Issue/kind`` is ``Issue/Kind/system``.
208+
///
209+
/// @Metadata {
210+
/// @Available(Swift, introduced: 6.2)
211+
/// }
195212
public static func filterIssues(_ isIncluded: @escaping @Sendable (Issue) -> Bool) -> Self {
196213
Self { issue in
197214
isIncluded(issue) ? issue : nil

Tests/TestingTests/Traits/IssueHandlingTraitTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
99
//
1010

11-
@testable @_spi(Experimental) @_spi(ForToolsIntegrationOnly) import Testing
11+
@testable @_spi(ForToolsIntegrationOnly) import Testing
1212

1313
@Suite("IssueHandlingTrait Tests")
1414
struct IssueHandlingTraitTests {

0 commit comments

Comments
 (0)