Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想用 gmock 说以下内容:
方法 A 应该被调用两次,一次使用参数 X,第二次使用参数 Y。不应再次调用该方法。
我知道如何做第一部分,但我怎么说永远不应该再次调用该方法?
{ InSequence s; EXPECT_CALL(mock, Method("X")); EXPECT_CALL(mock, Method("Y")); }
一旦收到这两个调用,对 Method 的进一步调用将产生错误。