From abd15e088e99b1c6334a427879fead0d557b7447 Mon Sep 17 00:00:00 2001 From: Mauro Aranda Date: Fri, 20 Nov 2020 19:28:03 -0300 Subject: [PATCH] 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 in: https://lists.gnu.org/archive/html/emacs-devel/2020-11/msg00914.html --- test/lisp/cus-edit-tests.el | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/lisp/cus-edit-tests.el b/test/lisp/cus-edit-tests.el index 114e461b7ac..bb88b8dd9fa 100644 --- a/test/lisp/cus-edit-tests.el +++ b/test/lisp/cus-edit-tests.el @@ -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 -- 2.39.5