From 8f9159ccd670bf5ffe189902de57f08278a1fe46 Mon Sep 17 00:00:00 2001 From: Ulrich Müller Date: Mon, 30 Sep 2024 18:12:14 +0200 Subject: Fix some byte-compiler warnings in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test/ebuild-mode-tests.el (cl-letf, cl-letf*): Enclose their definition in eval-when-compile. (ebuild-mode-test-font-lock): Call font-lock-fontify-region instead of font-lock-fontify-buffer. This is silent and also avoids the noninteractive trickery. * test/gentoo-newsitem-mode-tests.el (cl-letf, cl-letf*) (gentoo-newsitem-mode-test-font-lock): Ditto. (gentoo-newsitem-mode-test-run-silently): Remove. Signed-off-by: Ulrich Müller --- ChangeLog | 9 +++++++++ test/ebuild-mode-tests.el | 20 +++++++++----------- test/gentoo-newsitem-mode-tests.el | 20 +++++--------------- 3 files changed, 23 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4e803ca..1148355 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2024-09-30 Ulrich Müller + * test/ebuild-mode-tests.el (cl-letf, cl-letf*): Enclose their + definition in eval-when-compile. + (ebuild-mode-test-font-lock): Call font-lock-fontify-region + instead of font-lock-fontify-buffer. This is silent and also + avoids the noninteractive trickery. + * test/gentoo-newsitem-mode-tests.el (cl-letf, cl-letf*) + (gentoo-newsitem-mode-test-font-lock): Ditto. + (gentoo-newsitem-mode-test-run-silently): Remove. + * test/ebuild-mode-tests.el (ebuild-mode-test-skeleton): Remove unnecessary ebuild-mode-test-run-silently. * test/gentoo-newsitem-mode-tests.el diff --git a/test/ebuild-mode-tests.el b/test/ebuild-mode-tests.el index b566f24..6932bdd 100644 --- a/test/ebuild-mode-tests.el +++ b/test/ebuild-mode-tests.el @@ -23,9 +23,10 @@ (require 'ert) (require 'ebuild-mode) -(unless (fboundp 'cl-letf) - (defalias 'cl-letf #'letf) - (defalias 'cl-letf* #'letf*)) +(eval-when-compile + (unless (fboundp 'cl-letf) + (defalias 'cl-letf #'letf) + (defalias 'cl-letf* #'letf*))) (defmacro ebuild-mode-test-run-with-fixed-time (&rest body) (let ((zone (if (or (not (featurep 'xemacs)) @@ -68,17 +69,14 @@ (ert-deftest ebuild-mode-test-font-lock () (with-temp-buffer + (ebuild-mode-test-run-silently + (ebuild-mode)) (insert "src_install() {\n" "\temake install\n" "}\n") - (ebuild-mode-test-run-silently - (ebuild-mode) - (if (fboundp 'font-lock-ensure) - (font-lock-ensure) - ;; XEmacs refuses to fontify in batch mode, - ;; therefore pretend that we are interactive - (cl-letf (((symbol-function 'noninteractive) #'ignore)) - (font-lock-fontify-buffer)))) + (if (fboundp 'font-lock-ensure) + (font-lock-ensure) + (font-lock-fontify-region (point-min) (point-max))) (goto-char (point-min)) (search-forward "src_install") (should (equal (get-text-property (match-beginning 0) 'face) diff --git a/test/gentoo-newsitem-mode-tests.el b/test/gentoo-newsitem-mode-tests.el index c785153..b1363bd 100644 --- a/test/gentoo-newsitem-mode-tests.el +++ b/test/gentoo-newsitem-mode-tests.el @@ -23,16 +23,10 @@ (require 'ert) (require 'gentoo-newsitem-mode) -(unless (fboundp 'cl-letf) - (defalias 'cl-letf #'letf) - (defalias 'cl-letf* #'letf*)) - -(defmacro gentoo-newsitem-mode-test-run-silently (&rest body) - (if (boundp 'inhibit-message) - `(let ((inhibit-message t)) ,@body) - `(cl-letf (((symbol-function 'append-message) #'ignore) - ((symbol-function 'clear-message) #'ignore)) - ,@body))) +(eval-when-compile + (unless (fboundp 'cl-letf) + (defalias 'cl-letf #'letf) + (defalias 'cl-letf* #'letf*))) (defvar gentoo-newsitem-mode-test-input nil) @@ -45,11 +39,7 @@ (insert "Author: Larry the Cow\n") (if (fboundp 'font-lock-ensure) (font-lock-ensure) - ;; XEmacs refuses to fontify in batch mode, - ;; therefore pretend that we are interactive - (cl-letf (((symbol-function 'noninteractive) #'ignore)) - (gentoo-newsitem-mode-test-run-silently - (font-lock-fontify-buffer)))) + (font-lock-fontify-region (point-min) (point-max))) (goto-char (point-min)) (search-forward "Author") (should (equal (get-text-property (match-beginning 0) 'face) -- cgit v1.2.3-65-gdbad