【发布时间】:2020-08-15 01:55:50
【问题描述】:
尽管写作
- 这个答案(google mock - can I call EXPECT_CALL multiple times on same mock object?)
- 这个答案 (Interleaving EXPECT_CALL()s and calls to the mock functions)
- 还有这个问题 (Is interleaving
EXPECT_CALL()s and calls to the mock function really undefined behavior?)
...我仍然不知道为什么 Google 说这是未定义的行为:
...否则行为未定义。特别是,您不能将 EXPECT_CALL() 和对模拟函数的调用交错”(https://github.com/google/googletest/blob/master/googlemock/docs/for_dummies.md#using-mocks-in-tests)
他们只是掩盖了我上面的问题,重申它实际上是未定义的行为,但没有解释原因。
谁能解释为什么以及如何是未定义行为的详细信息?
【问题讨论】:
标签: c++ googletest undefined-behavior googlemock