Skip to content

Commit 64856c7

Browse files
Remove experimental spi from issue severity (#1247)
Remove experimental spi from issue severity ### Motivation: The Issue Severity proposal was approved. https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0013-issue-severity-warning.md ### Modifications: Removed experimental spi from issue severity and updated comments. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
1 parent aaa60ed commit 64856c7

File tree

3 files changed

+30
-16
lines changed

3 files changed

+30
-16
lines changed

Sources/Testing/Issues/Issue+Recording.swift

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ extension Issue {
5050
return self
5151
}
5252

53-
/// Record an issue when a running test fails unexpectedly.
53+
/// Records an issue that a test encounters while it's running.
5454
///
5555
/// - Parameters:
5656
/// - comment: A comment describing the expectation.
@@ -62,18 +62,23 @@ extension Issue {
6262
/// Use this function if, while running a test, an issue occurs that cannot be
6363
/// represented as an expectation (using the ``expect(_:_:sourceLocation:)``
6464
/// or ``require(_:_:sourceLocation:)-5l63q`` macros.)
65+
@_disfavoredOverload
66+
@_documentation(visibility: private)
67+
@available(*, deprecated, message: "Use record(_:severity:sourceLocation:) instead.")
6568
@discardableResult public static func record(
6669
_ comment: Comment? = nil,
6770
sourceLocation: SourceLocation = #_sourceLocation
6871
) -> Self {
6972
record(comment, severity: .error, sourceLocation: sourceLocation)
7073
}
7174

72-
/// Record an issue when a running test fails unexpectedly.
75+
/// Records an issue that a test encounters while it's running.
7376
///
7477
/// - Parameters:
7578
/// - comment: A comment describing the expectation.
76-
/// - severity: The severity of the issue.
79+
/// - severity: The severity level of the issue. The testing library marks the
80+
/// test as failed if the severity is greater than ``Issue/Severity/warning``.
81+
/// The default is ``Issue/Severity/error``.
7782
/// - sourceLocation: The source location to which the issue should be
7883
/// attributed.
7984
///
@@ -82,10 +87,13 @@ extension Issue {
8287
/// Use this function if, while running a test, an issue occurs that cannot be
8388
/// represented as an expectation (using the ``expect(_:_:sourceLocation:)``
8489
/// or ``require(_:_:sourceLocation:)-5l63q`` macros.)
85-
@_spi(Experimental)
90+
///
91+
/// @Metadata {
92+
/// @Available(Swift, introduced: 6.3)
93+
/// }
8694
@discardableResult public static func record(
8795
_ comment: Comment? = nil,
88-
severity: Severity,
96+
severity: Severity = .error,
8997
sourceLocation: SourceLocation = #_sourceLocation
9098
) -> Self {
9199
let sourceContext = SourceContext(backtrace: .current(), sourceLocation: sourceLocation)

Sources/Testing/Issues/Issue.swift

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ public struct Issue: Sendable {
8484
///
8585
/// - ``warning``
8686
/// - ``error``
87-
@_spi(Experimental)
87+
///
88+
/// @Metadata {
89+
/// @Available(Swift, introduced: 6.3)
90+
/// }
8891
public enum Severity: Sendable {
8992
/// The severity level for an issue which should be noted but is not
9093
/// necessarily an error.
@@ -101,7 +104,10 @@ public struct Issue: Sendable {
101104
}
102105

103106
/// The severity of this issue.
104-
@_spi(Experimental)
107+
///
108+
/// @Metadata {
109+
/// @Available(Swift, introduced: 6.3)
110+
/// }
105111
public var severity: Severity
106112

107113
/// Whether or not this issue should cause the test it's associated with to be
@@ -114,7 +120,10 @@ public struct Issue: Sendable {
114120
///
115121
/// Use this property to determine if an issue should be considered a failure, instead of
116122
/// directly comparing the value of the ``severity`` property.
117-
@_spi(Experimental)
123+
///
124+
/// @Metadata {
125+
/// @Available(Swift, introduced: 6.3)
126+
/// }
118127
public var isFailure: Bool {
119128
return !self.isKnown && self.severity >= .error
120129
}
@@ -324,7 +333,10 @@ extension Issue {
324333
public var kind: Kind.Snapshot
325334

326335
/// The severity of this issue.
327-
@_spi(Experimental)
336+
///
337+
/// @Metadata {
338+
/// @Available(Swift, introduced: 6.3)
339+
/// }
328340
public var severity: Severity
329341

330342
/// Any comments provided by the developer and associated with this issue.

Sources/Testing/Running/Configuration.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,7 @@ public struct Configuration: Sendable {
184184
/// Whether or not events of the kind ``Event/Kind-swift.enum/issueRecorded(_:)``
185185
/// containing issues with warning (or lower) severity should be delivered
186186
/// to the event handler of the configuration these options are applied to.
187-
///
188-
/// By default, events matching this criteria are not delivered to event
189-
/// handlers since this is an experimental feature.
190-
///
191-
/// - Warning: Warning issues are not yet an approved feature.
192-
@_spi(Experimental)
193-
public var isWarningIssueRecordedEventEnabled: Bool = false
187+
public var isWarningIssueRecordedEventEnabled: Bool = true
194188

195189
/// Whether or not events of the kind
196190
/// ``Event/Kind-swift.enum/expectationChecked(_:)`` should be delivered to

0 commit comments

Comments
 (0)