@@ -28,17 +28,17 @@ class TestOperationQueue : XCTestCase {
28
28
( " test_isSuspended " , test_isSuspended) ,
29
29
( " test_OperationDependencyCount " , test_OperationDependencyCount) ,
30
30
( " test_CancelDependency " , test_CancelDependency) ,
31
- /* ⚠️ */ ( " test_Deadlock " , testExpectedToFail ( test_Deadlock, " Crashes due to overrelease of OperationQueue " ) ) ,
31
+ ( " test_Deadlock " , test_Deadlock) ,
32
32
( " test_CancelOutOfQueue " , test_CancelOutOfQueue) ,
33
- /* ⚠️ */ ( " test_CrossQueueDependency " , testExpectedToFail ( test_CrossQueueDependency, " Crashes due to overrelease of OperationQueue " ) ) ,
33
+ ( " test_CrossQueueDependency " , test_CrossQueueDependency) ,
34
34
( " test_CancelWhileSuspended " , test_CancelWhileSuspended) ,
35
35
( " test_OperationOrder " , test_OperationOrder) ,
36
36
( " test_OperationOrder2 " , test_OperationOrder2) ,
37
- /* ⚠️ */ ( " test_WaitUntilFinished " , testExpectedToFail ( test_WaitUntilFinished, " Crashes due to overrelease of OperationQueue " ) ) ,
37
+ ( " test_WaitUntilFinished " , test_WaitUntilFinished) ,
38
38
( " test_OperationWaitUntilFinished " , test_OperationWaitUntilFinished) ,
39
- /* ⚠️ */ ( " test_CustomOperationReady " , testExpectedToFail ( test_CustomOperationReady, " Crashes due to overrelease of OperationQueue " ) ) ,
40
- /* ⚠️ */ ( " test_DependencyCycleBreak " , testExpectedToFail ( test_DependencyCycleBreak, " Crashes due to overrelease of OperationQueue " ) ) ,
41
- /* ⚠️ */ ( " test_Lifecycle " , testExpectedToFail ( test_Lifecycle, " Crashes due to overrelease of OperationQueue " ) ) ,
39
+ ( " test_CustomOperationReady " , test_CustomOperationReady) ,
40
+ ( " test_DependencyCycleBreak " , test_DependencyCycleBreak) ,
41
+ ( " test_Lifecycle " , test_Lifecycle) ,
42
42
]
43
43
}
44
44
@@ -55,7 +55,12 @@ class TestOperationQueue : XCTestCase {
55
55
queue. addOperation ( op2)
56
56
queue. addOperation ( op3)
57
57
XCTAssertEqual ( queue. operationCount, 2 )
58
- XCTAssertEqual ( queue. operations. count, 2 )
58
+ let operations = queue. operations
59
+ XCTAssertEqual ( operations. count, 2 )
60
+ if ( operations. count == 2 ) {
61
+ XCTAssertEqual ( operations [ 0 ] , op2)
62
+ XCTAssertEqual ( operations [ 1 ] , op3)
63
+ }
59
64
queue. waitUntilAllOperationsAreFinished ( )
60
65
XCTAssertEqual ( queue. operationCount, 0 )
61
66
XCTAssertEqual ( queue. operations. count, 0 )
@@ -547,6 +552,11 @@ class TestOperationQueue : XCTestCase {
547
552
let op1 = BlockOperation { Thread . sleep ( forTimeInterval: 1 ) }
548
553
queue1. addOperation ( op1)
549
554
op1. waitUntilFinished ( )
555
+
556
+ // Operation is not removed from Queue simultaneously
557
+ // with transitioning to "Finished" state. Wait a bit
558
+ // to allow OperationQueue to deal with finished op.
559
+ Thread . sleep ( forTimeInterval: 0.1 )
550
560
XCTAssertEqual ( queue1. operationCount, 0 )
551
561
}
552
562
@@ -656,7 +666,7 @@ class TestOperationQueue : XCTestCase {
656
666
} ( )
657
667
658
668
wait ( for: [ opStarted] , timeout: 1 )
659
- op2. cancel ( ) // op2
669
+ op2. cancel ( )
660
670
wait ( for: [ opDone] , timeout: 1 )
661
671
662
672
Thread . sleep ( forTimeInterval: 1 ) // Let queue to be deallocated
0 commit comments