summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2019-06-09 20:36:11 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2019-06-09 20:36:11 +0200
commitd3b78c85265b111bea3df8d9b2014e2acf960a54 (patch)
tree4e72ef420e48c67d8670b50006f5c8da417277ba
parent30a8cfa24b9450099f7ba365b7c16a1ddf75ed35 (diff)
downloademacs-d3b78c85265b111bea3df8d9b2014e2acf960a54.tar.gz
Refactor suppressions
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el43
1 files changed, 22 insertions, 21 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index 6672bc4ef5b..5953dd3b3bb 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