@@ -17,12 +17,34 @@ private import _TestingInternals
17
17
/// test is expected to pass or fail by passing them to
18
18
/// ``expect(exitsWith:observing:_:sourceLocation:performing:)`` or
19
19
/// ``require(exitsWith:observing:_:sourceLocation:performing:)``.
20
- @_spi ( Experimental)
20
+ ///
21
+ /// ## Topics
22
+ ///
23
+ /// ### Successful exit conditions
24
+ ///
25
+ /// - ``success``
26
+ ///
27
+ /// ### Failing exit conditions
28
+ ///
29
+ /// - ``failure``
30
+ /// - ``exitCode(_:)``
31
+ /// - ``signal(_:)``
32
+ ///
33
+ /// ### Comparing exit conditions
34
+ ///
35
+ /// - ``/Swift/Optional/==(_:_:)``
36
+ /// - ``/Swift/Optional/!=(_:_:)``
37
+ /// - ``/Swift/Optional/===(_:_:)``
38
+ /// - ``/Swift/Optional/!==(_:_:)``
21
39
#if SWT_NO_PROCESS_SPAWNING
22
40
@available ( * , unavailable, message: " Exit tests are not available on this platform. " )
23
41
#endif
24
42
public enum ExitCondition : Sendable {
25
43
/// The process terminated successfully with status `EXIT_SUCCESS`.
44
+ ///
45
+ /// The C programming language defines two [standard exit codes](https://en.cppreference.com/w/c/program/EXIT_status),
46
+ /// `EXIT_SUCCESS` and `EXIT_FAILURE` as well as `0` (as a synonym for
47
+ /// `EXIT_SUCCESS`.)
26
48
public static var success : Self {
27
49
// Strictly speaking, the C standard treats 0 as a successful exit code and
28
50
// potentially distinct from EXIT_SUCCESS. To my knowledge, no modern
@@ -76,7 +98,6 @@ public enum ExitCondition: Sendable {
76
98
77
99
// MARK: - Equatable
78
100
79
- @_spi ( Experimental)
80
101
#if SWT_NO_PROCESS_SPAWNING
81
102
@available ( * , unavailable, message: " Exit tests are not available on this platform. " )
82
103
#endif
@@ -107,7 +128,7 @@ extension Optional<ExitCondition> {
107
128
/// or [`Hashable`](https://developer.apple.com/documentation/swift/hashable).
108
129
///
109
130
/// For any values `a` and `b`, `a == b` implies that `a != b` is `false`.
110
- public static func == ( lhs: Self , rhs: Self ) -> Bool {
131
+ public static func == ( lhs: ExitCondition ? , rhs: ExitCondition ? ) -> Bool {
111
132
#if !SWT_NO_PROCESS_SPAWNING
112
133
return switch ( lhs, rhs) {
113
134
case let ( . failure, . exitCode( exitCode) ) , let ( . exitCode( exitCode) , . failure) :
@@ -149,7 +170,7 @@ extension Optional<ExitCondition> {
149
170
/// or [`Hashable`](https://developer.apple.com/documentation/swift/hashable).
150
171
///
151
172
/// For any values `a` and `b`, `a == b` implies that `a != b` is `false`.
152
- public static func != ( lhs: Self , rhs: Self ) -> Bool {
173
+ public static func != ( lhs: ExitCondition ? , rhs: ExitCondition ? ) -> Bool {
153
174
#if !SWT_NO_PROCESS_SPAWNING
154
175
!( lhs == rhs)
155
176
#else
@@ -183,7 +204,7 @@ extension Optional<ExitCondition> {
183
204
/// or [`Hashable`](https://developer.apple.com/documentation/swift/hashable).
184
205
///
185
206
/// For any values `a` and `b`, `a === b` implies that `a !== b` is `false`.
186
- public static func === ( lhs: Self , rhs: Self ) -> Bool {
207
+ public static func === ( lhs: ExitCondition ? , rhs: ExitCondition ? ) -> Bool {
187
208
return switch ( lhs, rhs) {
188
209
case ( . none, . none) :
189
210
true
@@ -224,7 +245,7 @@ extension Optional<ExitCondition> {
224
245
/// or [`Hashable`](https://developer.apple.com/documentation/swift/hashable).
225
246
///
226
247
/// For any values `a` and `b`, `a === b` implies that `a !== b` is `false`.
227
- public static func !== ( lhs: Self , rhs: Self ) -> Bool {
248
+ public static func !== ( lhs: ExitCondition ? , rhs: ExitCondition ? ) -> Bool {
228
249
#if !SWT_NO_PROCESS_SPAWNING
229
250
!( lhs === rhs)
230
251
#else
0 commit comments