Test rig exited abnormally with code 134 with OCMock verify on iOS 4

前端 未结 4 747
梦如初夏
梦如初夏 2021-01-03 08:52

I\'m trying to add OCMock to my iOS 4 project. To test it out, I have a class Person with one method, -hello. When I run this test:



        
4条回答
  •  醉话见心
    2021-01-03 09:14

    A workaround I've found is to wrap the [mockObject expect] and [mockObject verify] calls with XCTAssertNoThrow, e.g.:

    XCTAssertNoThrow([[mockTaskVC expect] showAlertWithTitle:containsString(@"Error") message:OCMOCK_ANY completion:OCMOCK_ANY], @"threw up exception");
    

    This will catch the exception and fail the text rather than crashing.

    Credit to author here: http://www.mulle-kybernetik.com/forum/viewtopic.php?f=4&t=315&p=710&hilit=unexpected+method+was+not+invoked+exception#p710

提交回复
热议问题