Skip to content

Commit e2a0f1b

Browse files
committed
account for swift 6 sendable's house of cards
1 parent 2a8ab20 commit e2a0f1b

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

Coder-Desktop/Coder-DesktopTests/FilePickerTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ struct FilePickerTests {
103103
try disclosureGroup.expand()
104104

105105
// Disclosure group should expand out to 3 more directories
106-
try #expect(await eventually { @MainActor in
107-
return try view.findAll(ViewType.DisclosureGroup.self).count == 6
106+
#expect(await eventually { @MainActor in
107+
return view.findAll(ViewType.DisclosureGroup.self).count == 6
108108
})
109109
}
110110
}

Coder-Desktop/Coder-DesktopTests/FileSyncDaemonTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ class FileSyncDaemonTests {
8181
// Write a file to Alpha
8282
let alphaFile = mutagenAlphaDirectory.appendingPathComponent("test.txt")
8383
try "Hello, World!".write(to: alphaFile, atomically: true, encoding: .utf8)
84-
try #expect(
84+
#expect(
8585
await eventually(timeout: .seconds(5), interval: .milliseconds(100)) { @MainActor in
86-
return try FileManager.default.fileExists(
86+
return FileManager.default.fileExists(
8787
atPath: self.mutagenBetaDirectory.appending(path: "test.txt").path()
8888
)
8989
})

Coder-Desktop/Coder-DesktopTests/Util.swift

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,19 @@ extension Inspection: @unchecked Sendable, @retroactive InspectionEmissary {}
6161
public func eventually(
6262
timeout: Duration = .milliseconds(500),
6363
interval: Duration = .milliseconds(10),
64-
condition: @escaping () async throws -> Bool
65-
) async throws -> Bool {
64+
condition: @Sendable () async throws -> Bool
65+
) async rethrows -> Bool {
6666
let endTime = ContinuousClock.now.advanced(by: timeout)
6767

68-
var lastError: Error?
69-
7068
while ContinuousClock.now < endTime {
7169
do {
7270
if try await condition() { return true }
73-
lastError = nil
7471
} catch {
75-
lastError = error
7672
try await Task.sleep(for: interval)
7773
}
7874
}
7975

80-
if let lastError {
81-
throw lastError
82-
}
83-
return false
76+
return try await condition()
8477
}
8578

8679
extension FileManager {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy