Skip to content

Commit d28c8ed

Browse files
committed
Fix build errors on xcode swift
1 parent 8e8946e commit d28c8ed

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

Tests/NimbleTests/PollingTest+Require.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ final class PollingRequireTest: XCTestCase {
101101

102102
func testToEventuallyAllowsInBackgroundThread() {
103103
#if !SWIFT_PACKAGE
104-
var executedAsyncBlock: Bool = false
105-
let asyncOperation: () -> Void = {
104+
let executedAsyncBlock = LockedContainer(false)
105+
let asyncOperation: @Sendable () -> Void = {
106106
do {
107107
try require {
108108
expect(1).toEventually(equal(1))
@@ -111,10 +111,10 @@ final class PollingRequireTest: XCTestCase {
111111
fail(error.localizedDescription)
112112
return
113113
}
114-
executedAsyncBlock = true
114+
executedAsyncBlock.set(true)
115115
}
116116
DispatchQueue.global().async(execute: asyncOperation)
117-
expect(executedAsyncBlock).toEventually(beTruthy())
117+
expect(executedAsyncBlock.value).toEventually(beTruthy())
118118
#endif
119119
}
120120

Tests/NimbleTests/PollingTest.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ final class PollingTest: XCTestCase {
155155
"""
156156
failsWithErrorMessage(msg) { // reference line
157157
waitUntil(timeout: .seconds(2)) { done in
158-
var protected: Int = 0
158+
let protected = LockedContainer(0)
159159
DispatchQueue.main.async {
160-
protected = 1
160+
protected.set(1)
161161
}
162162

163-
expect(protected).toEventually(equal(1))
163+
expect(protected.value).toEventually(equal(1))
164164
done()
165165
}
166166
}
@@ -215,29 +215,29 @@ final class PollingTest: XCTestCase {
215215

216216
func testWaitUntilAllowsInBackgroundThread() {
217217
#if !SWIFT_PACKAGE
218-
var executedAsyncBlock: Bool = false
218+
let executedAsyncBlock = LockedContainer(false)
219219
let asyncOperation: () -> Void = {
220220
expect {
221221
waitUntil { done in done() }
222222
}.toNot(raiseException(named: "InvalidNimbleAPIUsage"))
223-
executedAsyncBlock = true
223+
executedAsyncBlock.set(true)
224224
}
225225
DispatchQueue.global().async(execute: asyncOperation)
226-
expect(executedAsyncBlock).toEventually(beTruthy())
226+
expect(executedAsyncBlock.value).toEventually(beTruthy())
227227
#endif
228228
}
229229

230230
func testToEventuallyAllowsInBackgroundThread() {
231231
#if !SWIFT_PACKAGE
232-
var executedAsyncBlock: Bool = false
232+
let executedAsyncBlock = LockedContainer(false)
233233
let asyncOperation: () -> Void = {
234234
expect {
235235
expect(1).toEventually(equal(1))
236236
}.toNot(raiseException(named: "InvalidNimbleAPIUsage"))
237-
executedAsyncBlock = true
237+
executedAsyncBlock.set(true)
238238
}
239239
DispatchQueue.global().async(execute: asyncOperation)
240-
expect(executedAsyncBlock).toEventually(beTruthy())
240+
expect(executedAsyncBlock.value).toEventually(beTruthy())
241241
#endif
242242
}
243243

0 commit comments

Comments
 (0)