Skip to content

Commit

Permalink
Fix build errors on xcode swift
Browse files Browse the repository at this point in the history
  • Loading branch information
younata committed Oct 15, 2024
1 parent 8e8946e commit d28c8ed
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions Tests/NimbleTests/PollingTest+Require.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ final class PollingRequireTest: XCTestCase {

func testToEventuallyAllowsInBackgroundThread() {
#if !SWIFT_PACKAGE
var executedAsyncBlock: Bool = false
let asyncOperation: () -> Void = {
let executedAsyncBlock = LockedContainer(false)
let asyncOperation: @Sendable () -> Void = {
do {
try require {
expect(1).toEventually(equal(1))
Expand All @@ -111,10 +111,10 @@ final class PollingRequireTest: XCTestCase {
fail(error.localizedDescription)
return
}
executedAsyncBlock = true
executedAsyncBlock.set(true)
}
DispatchQueue.global().async(execute: asyncOperation)
expect(executedAsyncBlock).toEventually(beTruthy())
expect(executedAsyncBlock.value).toEventually(beTruthy())
#endif
}

Expand Down
18 changes: 9 additions & 9 deletions Tests/NimbleTests/PollingTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ final class PollingTest: XCTestCase {
"""
failsWithErrorMessage(msg) { // reference line
waitUntil(timeout: .seconds(2)) { done in
var protected: Int = 0
let protected = LockedContainer(0)
DispatchQueue.main.async {
protected = 1
protected.set(1)
}

expect(protected).toEventually(equal(1))
expect(protected.value).toEventually(equal(1))
done()
}
}
Expand Down Expand Up @@ -215,29 +215,29 @@ final class PollingTest: XCTestCase {

func testWaitUntilAllowsInBackgroundThread() {
#if !SWIFT_PACKAGE
var executedAsyncBlock: Bool = false
let executedAsyncBlock = LockedContainer(false)
let asyncOperation: () -> Void = {
expect {
waitUntil { done in done() }
}.toNot(raiseException(named: "InvalidNimbleAPIUsage"))
executedAsyncBlock = true
executedAsyncBlock.set(true)
}
DispatchQueue.global().async(execute: asyncOperation)
expect(executedAsyncBlock).toEventually(beTruthy())
expect(executedAsyncBlock.value).toEventually(beTruthy())
#endif
}

func testToEventuallyAllowsInBackgroundThread() {
#if !SWIFT_PACKAGE
var executedAsyncBlock: Bool = false
let executedAsyncBlock = LockedContainer(false)
let asyncOperation: () -> Void = {
expect {
expect(1).toEventually(equal(1))
}.toNot(raiseException(named: "InvalidNimbleAPIUsage"))
executedAsyncBlock = true
executedAsyncBlock.set(true)
}
DispatchQueue.global().async(execute: asyncOperation)
expect(executedAsyncBlock).toEventually(beTruthy())
expect(executedAsyncBlock.value).toEventually(beTruthy())
#endif
}

Expand Down

0 comments on commit d28c8ed

Please sign in to comment.