mimic icon indicating copy to clipboard operation
mimic copied to clipboard

Being able to call the original mocked function would be amazing.

Open kybishop opened this issue 1 year ago • 1 comments

There are many cases where I want to call the original function some number of times before then wanting to do something different, or perhaps wanting to call the original function conditionally dependent on the arguments.

I'm not aware of a current way of grabbing the original function. When I attempt this:

original = &MyModule.function/3

even if done before calling expect, I get the mocked function.

kybishop avatar Jan 19 '24 22:01 kybishop

(Hi, I just noticed this in passing, while checking up an issue I raised.)

It doesn't look particularly official but Mimic.Module.original/1 will give you access to the original module, and hence original functions.

paulanthonywilson avatar Feb 23 '24 11:02 paulanthonywilson

Yeah it might be worth exposing a proper way to call the original 🤔

edgurgel avatar Jun 03 '24 06:06 edgurgel