Skip to content

Commit 2895c9d

Browse files
committed
Tests: add a workaround for Windows
The Windows test regularly fails if the stdout is not flushed on completion. This increases the stability of the tests on Windows (though there is another async related issue lurking that causes a sporadic failure).
1 parent 1b0e65c commit 2895c9d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Tests/Functional/Asynchronous/Use/main.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
import XCTest
1010
#endif
1111

12+
#if os(Windows)
13+
import ucrt
14+
#endif
15+
1216
actor TestActor {
1317

1418
enum Errors: String, Error {
@@ -56,7 +60,11 @@ class AsyncAwaitTests: XCTestCase {
5660

5761
override func setUp() async throws {}
5862

59-
override func tearDown() async throws {}
63+
override func tearDown() async throws {
64+
#if os(Windows)
65+
fflush(stdout)
66+
#endif
67+
}
6068

6169
// CHECK: Test Case 'AsyncAwaitTests.test_explicitFailures_withinAsyncTests_areReported' started at \d+-\d+-\d+ \d+:\d+:\d+\.\d+
6270
// CHECK: .*[/\\]Asynchronous[/\\]Use[/\\]main.swift:[[@LINE+3]]: error: AsyncAwaitTests.test_explicitFailures_withinAsyncTests_areReported : XCTAssertTrue failed -

0 commit comments

Comments
 (0)