Commit d3b78c85 authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

Refactor suppressions

parent 30a8cfa2
......@@ -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
......
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