summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2019-06-09 21:05:37 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2019-06-09 21:05:37 +0200
commitcd2e61a844aa9bf896856eb10bd3730368f56820 (patch)
tree15e857accd19513b9a2e8a5c8948cbe6ea281f5e
parent2bc381511f9039b50370f9658da861a013faef9d (diff)
downloademacs-cd2e61a844aa9bf896856eb10bd3730368f56820.tar.gz
Add more tests
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el39
1 files changed, 34 insertions, 5 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index 5ced07ca697..d40a4a07f37 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -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