From 8d6d3364789471cc43acf14baaa4701e21574c2d Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Wed, 21 Aug 2024 19:47:25 -0400 Subject: [PATCH] Fix build errors in `ExitCondition` operators on platforms without exit tests. 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. --- Sources/Testing/ExitTests/ExitCondition.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Sources/Testing/ExitTests/ExitCondition.swift b/Sources/Testing/ExitTests/ExitCondition.swift index 205f7d515..ed6552e09 100644 --- a/Sources/Testing/ExitTests/ExitCondition.swift +++ b/Sources/Testing/ExitTests/ExitCondition.swift @@ -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 @@ -116,6 +119,7 @@ extension ExitCondition { default: lhs === rhs } +#endif } /// Check whether or not two values of this type are _not_ equal. @@ -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. @@ -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 } }