commit 38d3cb74d7f4c56a4a2a7235c50406912733f944 parent b0efadb00ee0fa276d3a39fc110d450542318fcf Author: Kévin Le Gouguec <kevin.legouguec@gmail.com> Date: Sun, 7 Jul 2024 18:40:25 +0200 Add recipe for monkey-patching in ERT Diffstat:
| M | guides/emacs/development.org | | | 7 | +++++++ |
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/guides/emacs/development.org b/guides/emacs/development.org @@ -67,6 +67,13 @@ a symbol -- Selects the test that the symbol names, signals an PREDICATE is a function that takes an ert-test object as argument, and returns non-nil if it is selected. #+end_quote +** Writing +*** Mocking functions +#+begin_src elisp +(cl-letf (((symbol-function 'read-something) + (lambda (&rest _) "result"))) + (some-command)) +#+end_src * Third-party packages ** forge