Skip to content

Fix build errors in ExitCondition operators on platforms without exit tests. #635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Sources/Testing/ExitTests/ExitCondition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ extension ExitCondition {
///
/// For any values `a` and `b`, `a == b` implies that `a != b` is `false`.
public static func ==(lhs: Self, rhs: Self) -> Bool {
#if SWT_NO_EXIT_TESTS
fatalError("Unsupported")
#else
return switch (lhs, rhs) {
case let (.failure, .exitCode(exitCode)), let (.exitCode(exitCode), .failure):
exitCode != EXIT_SUCCESS
Expand All @@ -116,6 +119,7 @@ extension ExitCondition {
default:
lhs === rhs
}
#endif
}

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

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