1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00

Make lexical-binding cookie warning test more robust

* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-tests--lexical-binding-cookie):
Run with lexical-binding both on and off.
This commit is contained in:
Mattias Engdegård 2024-04-03 11:27:16 +02:00
parent 7de192680f
commit 0c55261971

View File

@ -1348,12 +1348,14 @@ byte-compiled. Run with dynamic binding."
(string-search
"file has no `lexical-binding' directive on its first line"
(bytecomp-tests--log-from-compilation source))))
(let ((some-code "(defun my-fun () 12)\n"))
(should-not (cookie-warning
(concat ";;; -*-lexical-binding:t-*-\n" some-code)))
(should-not (cookie-warning
(concat ";;; -*-lexical-binding:nil-*-\n" some-code)))
(should (cookie-warning some-code)))))
(dolist (lb '(t nil))
(let ((lexical-binding lb)
(some-code "(defun my-fun () 12)\n"))
(should-not (cookie-warning
(concat ";;; -*-lexical-binding:t-*-\n" some-code)))
(should-not (cookie-warning
(concat ";;; -*-lexical-binding:nil-*-\n" some-code)))
(should (cookie-warning some-code))))))
(ert-deftest bytecomp-tests--unescaped-char-literals ()
"Check that byte compiling warns about unescaped character