Re: master e4df903f6b5 2/2: ; Fix last change

Richard Stallman <[email protected]> Wed, 29 Jul 2026 02:56:41 -0400
Newsgroups gmane.emacs.devel
Message-ID <[email protected]>
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > Writing tests in *-tests.el. For example, if I want to test a function,
  > which calls yes-or-no-p internally, I'll test both code paths like

  > --8<---------------cut here---------------start------------->8---
  > (cl-letf (((symbol-function #'yes-or-no-p) #'always))
  >   ...)

  > (cl-letf (((symbol-function #'yes-or-no-p) #'ignore))
  >   ...)
  > --8<---------------cut here---------------end--------------->8---

This is interesting.

Is there a short list of functions which it is useful for tests to
force?  Or is that technique potentially useful for very many functions?

I think it could be be cleaner, and help discourage uncontrolled uses
of cl-letf, to define a macro that would be used like this:

(testing-force-value (yes-or-no-p t)
  ...tests...)

The name of this macro, and other features useful for tests, could
avoid suggesting using this in other clever ways that are not wise design.


-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)