Skip to content

Commit 888caad

Browse files
authored
Fix build errors in ExitCondition operators on platforms without exit tests. (#635)
On platforms without exit tests, `ExitCondition` is marked unavailable. On those platforms, the new operators on `ExitCondition` call each other and the compiler complains because they're calling unavailable symbols. Silence the compiler. ### 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 5772c9a commit 888caad

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Sources/Testing/ExitTests/ExitCondition.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ extension ExitCondition {
105105
///
106106
/// For any values `a` and `b`, `a == b` implies that `a != b` is `false`.
107107
public static func ==(lhs: Self, rhs: Self) -> Bool {
108+
#if SWT_NO_EXIT_TESTS
109+
fatalError("Unsupported")
110+
#else
108111
return switch (lhs, rhs) {
109112
case let (.failure, .exitCode(exitCode)), let (.exitCode(exitCode), .failure):
110113
exitCode != EXIT_SUCCESS
@@ -116,6 +119,7 @@ extension ExitCondition {
116119
default:
117120
lhs === rhs
118121
}
122+
#endif
119123
}
120124

121125
/// Check whether or not two values of this type are _not_ equal.
@@ -145,7 +149,11 @@ extension ExitCondition {
145149
///
146150
/// For any values `a` and `b`, `a == b` implies that `a != b` is `false`.
147151
public static func !=(lhs: Self, rhs: Self) -> Bool {
152+
#if SWT_NO_EXIT_TESTS
153+
fatalError("Unsupported")
154+
#else
148155
!(lhs == rhs)
156+
#endif
149157
}
150158

151159
/// Check whether or not two values of this type are identical.
@@ -215,6 +223,10 @@ extension ExitCondition {
215223
///
216224
/// For any values `a` and `b`, `a === b` implies that `a !== b` is `false`.
217225
public static func !==(lhs: Self, rhs: Self) -> Bool {
226+
#if SWT_NO_EXIT_TESTS
227+
fatalError("Unsupported")
228+
#else
218229
!(lhs === rhs)
230+
#endif
219231
}
220232
}

0 commit comments

Comments
 (0)