sinojelly / mockcpp

Two C/C++ testing tools, mockcpp and testngpp.
Apache License 2.0
66 stars 39 forks source link

Using invoke multiple times for stubbing the same function does not work properly.(同一函数打桩使用多次invoke无法很好工作) #60

Open WFrame0224 opened 2 months ago

WFrame0224 commented 2 months ago

When using the MOCKER in the following way, the expectation is: func1, func1, func2; however, during actual runtime, the second rule for func1 is skipped, and the stubbing effect becomes func1, func2. 下面这种方式MOCKER时,期待:func1,func1,func2;但是实际运行时出现,func1第二次规则会被跳过,打桩效果变为func1,func2

MOCKER(xxx)
    .stubs()
    .will(invoke(func1))
    .then(invoke(func1))
    .then(invoke(func2));