From 38d3cb74d7f4c56a4a2a7235c50406912733f944 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Sun, 7 Jul 2024 18:40:25 +0200 Subject: Add recipe for monkey-patching in ERT --- guides/emacs/development.org | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/guides/emacs/development.org b/guides/emacs/development.org index 92e2909..f1363e1 100644 --- 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 -- cgit v1.2.3