@@ -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