Skip to content
Browse files
Clarify and fix example of passthrough/1
Example was no longer working on newer Erlang versions because the shell used the string module while being mocked. Adding the passthrough options solved this. Also added an actual example of using the passthrough/1 function in only some clauses. Fixes #224
  • Loading branch information
eproxus committed Feb 17, 2021
1 parent 47b0e96 commit 11021fde6cf10d8c87d26dc948b2edda32b40bfc
Showing 1 changed file with 10 additions and 5 deletions.
@@ -131,16 +131,21 @@ function with the same name as the expect is defined in):

Eshell V5.8.4 (abort with ^G)
1> meck:new(string, [unstick]).
1> meck:new(string, [unstick, passthrough]).
2> meck:expect(string, strip, fun(String) -> meck:passthrough([String]) end).
2> meck:expect(string, strip, fun
("foo") -> "bar";
(String) -> meck:passthrough([String])
3> string:strip(" test ").
4> meck:unload(string).
4> string:strip("foo").
5> meck:unload(string).
5> string:strip(" test ").
5> string:strip("foo").

## Use

0 comments on commit 11021fd

Please sign in to comment.