Skip to content

Commit b8f9d58

Browse files
committed
Fixes tests of OperationQueue: result of assignment was immmediately deallocated because of weak property
1 parent 9b5a7d3 commit b8f9d58

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Tests/Foundation/Tests/TestOperationQueue.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,11 @@ class TestOperationQueue : XCTestCase {
229229

230230
func test_CurrentQueueWithCustomUnderlyingQueue() {
231231
let expectation = self.expectation(description: "Background execution")
232-
232+
233233
let operationQueue = OperationQueue()
234-
operationQueue.underlyingQueue = DispatchQueue(label: "underlying_queue")
235-
234+
let underlyingQueue = DispatchQueue(label: "underlying_queue")
235+
operationQueue.underlyingQueue = underlyingQueue
236+
236237
operationQueue.addOperation {
237238
XCTAssertEqual(operationQueue, OperationQueue.current)
238239
expectation.fulfill()
@@ -268,7 +269,8 @@ class TestOperationQueue : XCTestCase {
268269
let expectation = self.expectation(description: "Background execution")
269270

270271
let operationQueue = OperationQueue()
271-
operationQueue.underlyingQueue = DispatchQueue(label: "underlying_queue")
272+
let underlyingQueue = DispatchQueue(label: "underlying_queue")
273+
operationQueue.underlyingQueue = underlyingQueue
272274
operationQueue.underlyingQueue = nil
273275

274276
operationQueue.addOperation {

0 commit comments

Comments
 (0)