diff --git a/Examples/coobjcBaseExample/coobjcBaseExampleTests/coobjcPromiseTests.m b/Examples/coobjcBaseExample/coobjcBaseExampleTests/coobjcPromiseTests.m index d2d08e5..4e01d0e 100644 --- a/Examples/coobjcBaseExample/coobjcBaseExampleTests/coobjcPromiseTests.m +++ b/Examples/coobjcBaseExample/coobjcBaseExampleTests/coobjcPromiseTests.m @@ -415,6 +415,7 @@ static id testPromise3() { }); it(@"test progress promise error", ^{ + __block int step = 0; co_launch(^{ int progressCount = 0; COProgressPromise *promise = progressDownloadFileFromUrl(@"http://img17.3lianghhjghj.com/d/file/201701/17/9a0d018ba683b9cbdcc5a7267b90891c.jpg1111"); @@ -426,13 +427,15 @@ static id testPromise3() { NSLog(@"current progress: %f", (float)v); progressCount++; } - expect(progressCount).to.equal(1); + expect(progressCount > 0).to.beTruthy(); NSData *data = await(promise); expect(data == nil).beTruthy(); expect(co_getError() != nil).beTruthy(); + step = 11; }); waitUntil(^(DoneCallback done) { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + expect(step).to.equal(11); done(); }); }); @@ -681,6 +684,8 @@ static id testPromise3() { }); it(@"test progress promise error", ^{ + __block int step = 0; + [[TestThreadObject1 sharedInstance] runBlock:^{ co_launch(^{ int progressCount = 0; @@ -693,16 +698,18 @@ static id testPromise3() { NSLog(@"current progress: %f", (float)v); progressCount++; } - expect(progressCount).to.equal(1); +// expect(progressCount).to.equal(1); NSData *data = await(promise); expect(data == nil).beTruthy(); expect(co_getError() != nil).beTruthy(); + step = 11; }); }]; waitUntil(^(DoneCallback done) { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ done(); + expect(step).to.equal(11); }); }); });