Skip to content

Commit 69e8aee

Browse files
committed
test: Update unit tests to adjust expectations for linux targets. Linux doesn't run main actor on the main thread, so the expectation was not correct. Adjusted expectations.
1 parent cada3e8 commit 69e8aee

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Tests/DispatchAsyncTests/DispatchQueueTests.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,14 @@ import class Foundation.Thread
2424
func testBasicDispatchQueueMain() async throws {
2525
let asyncValue = await withCheckedContinuation { continuation in
2626
DispatchQueue.main.async {
27-
// Main queue should be on main thread.
28-
#if !os(WASI)
29-
#expect(Thread.isMainThread)
27+
// Main queue should be on main thread on apple platforms.
28+
// On linux platforms, there is no guarantee that the main queue is on the main thread,
29+
// only that it is on the main actor.
30+
31+
#if os(LINUX)
32+
#expect(DispatchQueue.isMain)
33+
#elseif !os(WASI)
34+
#expect(Thread.isMainThread) // NOTE: Thread API's aren't currently available on OS(WASI), as of June 2025
3035
#endif
3136
continuation.resume(returning: true)
3237
}

0 commit comments

Comments
 (0)