Use cl-letf instead of unwind-protect in a test
* test/lisp/cus-edit-tests.el (cus-edit-tests-customize-saved/show-obsolete): Good use case for cl-letf, so use it. Suggested by Stefan Monnier <monnier@iro.umontreal.ca> in: https://lists.gnu.org/archive/html/emacs-devel/2020-11/msg00914.html
This commit is contained in:
parent
ac98bcc906
commit
abd15e088e
1 changed files with 4 additions and 6 deletions
|
@ -23,6 +23,7 @@
|
|||
|
||||
(require 'ert)
|
||||
(require 'ert-x)
|
||||
(eval-when-compile (require 'cl-lib))
|
||||
(require 'cus-edit)
|
||||
|
||||
(defmacro with-cus-edit-test (buffer &rest body)
|
||||
|
@ -71,12 +72,9 @@
|
|||
|
||||
(ert-deftest cus-edit-tests-customize-saved/show-obsolete ()
|
||||
(with-cus-edit-test "*Customize Saved*"
|
||||
(unwind-protect
|
||||
(progn
|
||||
(put 'cus-edit-tests--obsolete-option-tag 'saved-value '(t))
|
||||
(customize-saved)
|
||||
(should (search-forward cus-edit-tests--obsolete-option-tag nil t)))
|
||||
(put 'cus-edit-tests--obsolete-option-tag 'saved-value nil))))
|
||||
(cl-letf (((get 'cus-edit-tests--obsolete-option-tag 'saved-value) '(t)))
|
||||
(customize-saved)
|
||||
(should (search-forward cus-edit-tests--obsolete-option-tag nil t)))))
|
||||
|
||||
(provide 'cus-edit-tests)
|
||||
;;; cus-edit-tests.el ends here
|
||||
|
|
Loading…
Add table
Reference in a new issue