Pattern for unit testing async queue that calls main queue on completion

后端 未结 6 517
慢半拍i
慢半拍i 2020-12-04 14:52

This is related to my previous question, but different enough that I figured I\'d throw it into a new one. I have some code that runs async on a custom queue, then executes

6条回答
  •  北海茫月
    2020-12-04 15:09

    Square included a clever addition to SenTestCase in their SocketRocket project that makes this easy. You can call it like this:

    [self runCurrentRunLoopUntilTestPasses:^BOOL{
        return [someOperation isDone];
    } timeout: 60 * 60];
    

    The code is available here:

    SenTestCase+SRTAdditions.h

    SenTestCase+SRTAdditions.m

提交回复
热议问题