OCMock/OCMVerify - 未使用的表达式结果

OCMock/OCMVerify - Expression result unused

由于 Expression result unused warning/error:

,无法编译如下调用
id object = [Foo new];
id mockObject = OCMPartialMock(object);
...
OCMExpect([mockObject doTheThing]);
...
OCMVerify(mockObject);

测试于 Xcode 12 GM:

$ clang -v
Apple clang version 12.0.0 (clang-1200.0.32.2)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode_12_GM.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

OCMVerify(...) 替换为 OCMVerifyAll(...)

OCMVerify(...) 用于验证 运行 之后的调用,而 OCMVerifyAll(...) 用于验证在 运行.

之前声明的期望
id object = [Foo new];
id mockObject = OCMPartialMock(object);
...
OCMExpect([mockObject doTheThing]);
...
OCMVerifyAll(mockObject);