Skip to content

Commit

Permalink
fix unit test, fix alibaba#34
Browse files Browse the repository at this point in the history
  • Loading branch information
NianJi committed Mar 6, 2019
1 parent 28fead4 commit 1ad4f47
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ static id testPromise3() {
});

it(@"test concurrent await promise", ^{
__block int val = 0;
co_launch(^{

NSTimeInterval begin = CACurrentMediaTime();
Expand All @@ -391,9 +392,11 @@ static id testPromise3() {

NSTimeInterval duration = CACurrentMediaTime() - begin;
expect(duration < 5.5).beTruthy();
val = 1;
});
waitUntil(^(DoneCallback done) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(6 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
expect(val).to.equal(1);
done();
});
});
Expand Down

0 comments on commit 1ad4f47

Please sign in to comment.