Use advice-flet' in place of
cl-letf' to avoid primitive redefinition
* test/lisp/time-stamp-tests.el (with-time-stamp-system-name): Use `advice-flet' to advice primitive avoiding redefinition. * test/lisp/tempo-tests.el (tempo-p-element-test) (tempo-P-element-test, tempo-r-element-test) (tempo-s-element-test, tempo-r>-element-test): Likewise. * test/lisp/subr-tests.el (subr-tests-bug22027): Likewise. * test/lisp/shadowfile-tests.el (shadow-test00-clusters) (shadow-test01-sites, shadow-test06-literal-groups) (shadow-test07-regexp-groups): Likewise. * test/lisp/replace-tests.el (replace-tests-with-undo): Likewise. * test/lisp/play/dissociate-tests.el (dissociate-tests-dissociated-press): Likewise. * test/lisp/net/tramp-tests.el (tramp-test10-write-region) (tramp-test21-file-links): Likewise. * test/lisp/kmacro-tests.el (kmacro-tests-call-macro-hint-and-repeat) (kmacro-tests-repeat-on-last-key) (kmacro-tests-repeat-view-and-run) (kmacro-tests-bind-to-key-with-key-sequence-in-use): Likewise. * test/lisp/files-tests.el (files-tests-read-file-in-~): Likewise. * test/lisp/emacs-lisp/rmc-tests.el (test-read-multiple-choice): Likewise. * test/lisp/bookmark-tests.el (bookmark-test-bmenu-locate): Likewise. * test/lisp/abbrev-tests.el (inverse-add-abbrev-skips-trailing-nonword) (inverse-add-abbrev-skips-trailing-nonword/positive-arg) (inverse-add-abbrev-skips-trailing-nonword/negative-arg): Likewise.
This commit is contained in:
parent
d07d7ab1a0
commit
825e85b393
12 changed files with 119 additions and 115 deletions
|
@ -33,10 +33,12 @@
|
|||
|
||||
(ert-deftest test-read-multiple-choice ()
|
||||
(dolist (char '(?y ?n))
|
||||
(cl-letf* (((symbol-function #'read-event) (lambda () char))
|
||||
(str (if (eq char ?y) "yes" "no")))
|
||||
(should (equal (list char str)
|
||||
(read-multiple-choice "Do it? " '((?y "yes") (?n "no"))))))))
|
||||
(let ((str (if (eq char ?y) "yes" "no")))
|
||||
(advice-flet ((read-event
|
||||
(lambda () char)))
|
||||
(should (equal (list char str)
|
||||
(read-multiple-choice "Do it? "
|
||||
'((?y "yes") (?n "no")))))))))
|
||||
|
||||
|
||||
(provide 'rmc-tests)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue