emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] scratch/with-suppressed-warnings d3b78c8 1/3: Refactor sup


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] scratch/with-suppressed-warnings d3b78c8 1/3: Refactor suppressions
Date: Sun, 9 Jun 2019 15:05:46 -0400 (EDT)

branch: scratch/with-suppressed-warnings
commit d3b78c85265b111bea3df8d9b2014e2acf960a54
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Refactor suppressions
---
 test/lisp/emacs-lisp/bytecomp-tests.el | 43 +++++++++++++++++-----------------
 1 file changed, 22 insertions(+), 21 deletions(-)

diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el 
b/test/lisp/emacs-lisp/bytecomp-tests.el
index 6672bc4..5953dd3 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -680,29 +680,30 @@ literals (Bug#20852)."
       (should-not (member '(byte-constant 333) lap))
       (should (member '(byte-constant 444) lap)))))
 
-(ert-deftest bytecomp-test--with-suppressed-warnings ()
+(defun test-suppression (form match)
   (let ((lexical-binding t)
         (byte-compile-log-buffer (generate-new-buffer " *Compile-Log*")))
-    (let ((form '(defvar prefixless)))
-      (with-current-buffer byte-compile-log-buffer
-        (let ((inhibit-read-only t))
-          (erase-buffer)))
-      (test-byte-comp-compile-and-load t
-        form)
-      (with-current-buffer byte-compile-log-buffer
-        (goto-char (point-min))
-        (should (re-search-forward "global/dynamic var .prefixless. lacks"
-                                   nil t)))
-      (with-current-buffer byte-compile-log-buffer
-        (let ((inhibit-read-only t))
-          (erase-buffer)))
-      (test-byte-comp-compile-and-load t
-        `(with-suppressed-warnings ((lexical prefixless))
-           ,form))
-      (with-current-buffer byte-compile-log-buffer
-        (goto-char (point-min))
-        (should-not (re-search-forward "global/dynamic var .prefixless. lacks"
-                                       nil t))))))
+    (with-current-buffer byte-compile-log-buffer
+      (let ((inhibit-read-only t))
+        (erase-buffer)))
+    (test-byte-comp-compile-and-load t
+      form)
+    (with-current-buffer byte-compile-log-buffer
+      (goto-char (point-min))
+      (should (re-search-forward match nil t)))
+    (with-current-buffer byte-compile-log-buffer
+      (let ((inhibit-read-only t))
+        (erase-buffer)))
+    (test-byte-comp-compile-and-load t
+      `(with-suppressed-warnings ((lexical prefixless))
+         ,form))
+    (with-current-buffer byte-compile-log-buffer
+      (goto-char (point-min))
+      (should-not (re-search-forward match nil t)))))
+
+(ert-deftest bytecomp-test--with-suppressed-warnings ()
+  (test-suppression '(defvar prefixless)
+                    "global/dynamic var .prefixless. lacks"))
 
 ;; Local Variables:
 ;; no-byte-compile: t



reply via email to

[Prev in Thread] Current Thread [Next in Thread]