Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问下如何恢复打桩前? #4

Closed
codeshredder opened this issue Nov 11, 2019 · 1 comment
Closed

请问下如何恢复打桩前? #4

codeshredder opened this issue Nov 11, 2019 · 1 comment

Comments

@codeshredder
Copy link

发现
EMOCK(&Foo::bar1)
.stubs()
.will(returnValue(1));
后Foo::bar1就永远打桩成这样了。
我有个场景
先打桩跑一下,然后再恢复没打桩之前的状态继续跑。不知道如何操作。多谢

@orca-zhang
Copy link
Member

可以使用:

GlobalMockObject::verify();

或者

GlobalMockObject::reset();

前者带约束检查,比如约定必须被调用1次,检查是否已经调用1次,如果不是,会抛出异常
后者是纯粹的清理(恢复打桩前)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants