summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2024-09-30 18:12:14 +0200
committerUlrich Müller <ulm@gentoo.org>2024-10-02 23:00:39 +0200
commit8f9159ccd670bf5ffe189902de57f08278a1fe46 (patch)
treebd065687f983adb1af82fb33ac7a7b7a5d762634
parentRemove unnecessary *-run-silently wrappers in tests (diff)
downloadebuild-mode-8f9159ccd670bf5ffe189902de57f08278a1fe46.tar.gz
ebuild-mode-8f9159ccd670bf5ffe189902de57f08278a1fe46.tar.bz2
ebuild-mode-8f9159ccd670bf5ffe189902de57f08278a1fe46.zip
Fix some byte-compiler warnings in tests
* 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 <ulm@gentoo.org>
-rw-r--r--ChangeLog9
-rw-r--r--test/ebuild-mode-tests.el20
-rw-r--r--test/gentoo-newsitem-mode-tests.el20
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 <ulm@gentoo.org>
+ * 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)