aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMattias EngdegÄrd2022-06-06 10:47:42 +0200
committerMattias EngdegÄrd2022-06-06 10:54:30 +0200
commit138d2f22f731bc3faf6de26b67e2b50ce9131541 (patch)
tree395eb9285ce32b29bc5e7c2a32fa2c7c99fae4f6 /test
parent3cbdd5914658f39f53baaeaf6a0aadfa534c02e8 (diff)
downloademacs-138d2f22f731bc3faf6de26b67e2b50ce9131541.tar.gz
emacs-138d2f22f731bc3faf6de26b67e2b50ce9131541.zip
Test warning suppressions with lexical binding
* test/lisp/emacs-lisp/bytecomp-tests.el (test-byte-comp-compile-and-load): Add lexical cookie to file being compiled as part of the test. (bytecomp-test--with-suppressed-warnings): Comment out the test for suppressing warnings when attempting to let-bind `nil`, as that (1) doesn't work and (2) is a silly thing to do anyway.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el20
1 files changed, 14 insertions, 6 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index 049eed10f94..39f053136ae 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -747,6 +747,7 @@ byte-compiled. Run with dynamic binding."
747 (ert-with-temp-file elcfile 747 (ert-with-temp-file elcfile
748 :suffix ".elc" 748 :suffix ".elc"
749 (with-temp-buffer 749 (with-temp-buffer
750 (insert ";;; -*- lexical-binding: t -*-\n")
750 (dolist (form forms) 751 (dolist (form forms)
751 (print form (current-buffer))) 752 (print form (current-buffer)))
752 (write-region (point-min) (point-max) elfile nil 'silent)) 753 (write-region (point-min) (point-max) elfile nil 'silent))
@@ -1227,12 +1228,19 @@ literals (Bug#20852)."
1227 '((lexical prefixless)) 1228 '((lexical prefixless))
1228 "global/dynamic var .prefixless. lacks") 1229 "global/dynamic var .prefixless. lacks")
1229 1230
1230 (test-suppression 1231 ;; FIXME: These messages cannot be suppressed reliably right now,
1231 '(defun foo() 1232 ;; but attempting mutate `nil' or `5' is a rather daft thing to do
1232 (let ((nil t)) 1233 ;; in the first place. Preventing mutation of constants such as
1233 (message-mail))) 1234 ;; `most-positive-fixnum' makes more sense but the compiler doesn't
1234 '((constants nil)) 1235 ;; warn about that at all right now (it's caught at runtime, and we
1235 "Warning: attempt to let-bind constant .nil.") 1236 ;; allow writing the same value).
1237 ;;
1238 ;; (test-suppression
1239 ;; '(defun foo()
1240 ;; (let ((nil t))
1241 ;; (message-mail)))
1242 ;; '((constants nil))
1243 ;; "Warning: attempt to let-bind constant .nil.")
1236 1244
1237 (test-suppression 1245 (test-suppression
1238 '(progn 1246 '(progn