Skip to content

Commit d645e48

Browse files
committed
Correct bug in cancellation code when building on platforms without exit tests
1 parent 64c8ce6 commit d645e48

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/Testing/Test+Cancellation.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@ private func _cancel<T>(_ cancellableValue: T?, for testAndTestCase: (Test?, Tes
139139
task?.cancel()
140140
}
141141

142-
if ExitTest.current != nil {
142+
var inExitTest = false
143+
#if !SWT_NO_EXIT_TESTS
144+
inExitTest = (ExitTest.current != nil)
145+
#endif
146+
if inExitTest {
143147
// This code is running in an exit test. We don't have a "current test" or
144148
// "current test case" in the child process, so we'll let the parent
145149
// process sort that out.

0 commit comments

Comments
 (0)