Commit cd2e61a8 authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

Add more tests

parent 2bc38151
Pipeline #1959 failed with stage
in 2 seconds
......@@ -687,9 +687,10 @@ literals (Bug#20852)."
(with-current-buffer byte-compile-log-buffer
(let ((inhibit-read-only t))
(erase-buffer)))
(test-byte-comp-compile-and-load t
form)
(test-byte-comp-compile-and-load t form)
(with-current-buffer byte-compile-log-buffer
(unless match
(error "%s" (buffer-string)))
(goto-char (point-min))
(should (re-search-forward match nil t)))
;; And that it's gone now.
......@@ -697,8 +698,8 @@ literals (Bug#20852)."
(let ((inhibit-read-only t))
(erase-buffer)))
(test-byte-comp-compile-and-load t
`(with-suppressed-warnings ,suppress
,form))
`(with-suppressed-warnings ,suppress
,form))
(with-current-buffer byte-compile-log-buffer
(goto-char (point-min))
(should-not (re-search-forward match nil t)))
......@@ -710,7 +711,35 @@ literals (Bug#20852)."
(ert-deftest bytecomp-test--with-suppressed-warnings ()
(test-suppression '(defvar prefixless)
'((lexical prefixless))
"global/dynamic var .prefixless. lacks"))
"global/dynamic var .prefixless. lacks")
(test-suppression '(defun foo()
(let ((nil t))
(message-mail)))
'((constants nil))
"Warning: attempt to let-bind constant .nil.")
(test-suppression '(progn
(defun obsolete ()
(declare (obsolete foo "22.1")))
(defun zot ()
(obsolete)))
'((obsolete obsolete))
"Warning: .obsolete. is an obsolete function")
(test-suppression '(progn
(defun wrong-params (foo &optional unused)
(ignore unused)
foo)
(defun zot ()
(wrong-params 1 2 3)))
'((callargs wrong-params))
"Warning: wrong-params called with")
(test-byte-comp-compile-and-load nil
(defvar obsolete-variable nil)
(make-obsolete-variable 'obsolete-variable nil "24.1"))
(test-suppression '(defun zot ()
obsolete-variable)
'((obsolete obsolete-variable))
"obsolete")
)
;; 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