agiledragon / gomonkey

gomonkey is a library to make monkey patching in unit tests easy
MIT License
2k stars 179 forks source link

请问可以重复打桩吗? #26

Closed folivoramao closed 4 years ago

folivoramao commented 4 years ago

比如被测函数为a,在a中依次调用了2次函数b,分别对这两个函数b打桩吗?

agiledragon commented 4 years ago

不需要。 以函数为例:使用ApplyFunc给b打一个桩,多次调用b都返回同样的桩;使用ApplyFuncSeq给b打序列桩,多次调用b返回不同的桩。

folivoramao commented 4 years ago

谢谢