Why does a false assertion in async test in GHUnit crash the app instead of just failing the test?

前端 未结 4 2160
北荒
北荒 2021-02-20 04:15

This question has very few views and no answers yet. If you have a suggestion what to change about this question to get more eyeballs, I\'d be happy to hear them. Ch

4条回答
  •  南方客
    南方客 (楼主)
    2021-02-20 04:37

    Looking at the header files for GHUnit, it looks like that may be what is supposed to happen with your code. A subclass of GHUnit could override this method:

    // Override any exceptions; By default exceptions are raised, causing a test failure
    - (void)failWithException:(NSException *)exception { }
    

    To not throw exceptions, but an easier solution is to use the GHAssertTrueNoThrow instead of GHAssertTrue macro.

提交回复
热议问题