Commit d3b78c85 authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

Refactor suppressions

parent 30a8cfa2
...@@ -680,29 +680,30 @@ literals (Bug#20852)." ...@@ -680,29 +680,30 @@ literals (Bug#20852)."
(should-not (member '(byte-constant 333) lap)) (should-not (member '(byte-constant 333) lap))
(should (member '(byte-constant 444) lap))))) (should (member '(byte-constant 444) lap)))))
(ert-deftest bytecomp-test--with-suppressed-warnings () (defun test-suppression (form match)
(let ((lexical-binding t) (let ((lexical-binding t)
(byte-compile-log-buffer (generate-new-buffer " *Compile-Log*"))) (byte-compile-log-buffer (generate-new-buffer " *Compile-Log*")))
(let ((form '(defvar prefixless))) (with-current-buffer byte-compile-log-buffer
(with-current-buffer byte-compile-log-buffer (let ((inhibit-read-only t))
(let ((inhibit-read-only t)) (erase-buffer)))
(erase-buffer))) (test-byte-comp-compile-and-load t
(test-byte-comp-compile-and-load t form)
form) (with-current-buffer byte-compile-log-buffer
(with-current-buffer byte-compile-log-buffer (goto-char (point-min))
(goto-char (point-min)) (should (re-search-forward match nil t)))
(should (re-search-forward "global/dynamic var .prefixless. lacks" (with-current-buffer byte-compile-log-buffer
nil t))) (let ((inhibit-read-only t))
(with-current-buffer byte-compile-log-buffer (erase-buffer)))
(let ((inhibit-read-only t)) (test-byte-comp-compile-and-load t
(erase-buffer))) `(with-suppressed-warnings ((lexical prefixless))
(test-byte-comp-compile-and-load t ,form))
`(with-suppressed-warnings ((lexical prefixless)) (with-current-buffer byte-compile-log-buffer
,form)) (goto-char (point-min))
(with-current-buffer byte-compile-log-buffer (should-not (re-search-forward match nil t)))))
(goto-char (point-min))
(should-not (re-search-forward "global/dynamic var .prefixless. lacks" (ert-deftest bytecomp-test--with-suppressed-warnings ()
nil t)))))) (test-suppression '(defvar prefixless)
"global/dynamic var .prefixless. lacks"))
;; Local Variables: ;; Local Variables:
;; no-byte-compile: t ;; no-byte-compile: t
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment