diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2024-04-03 11:27:16 +0200 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2024-04-03 11:27:16 +0200 |
commit | 0c55261971b0fea62a8e94204e544ff8af714a2e (patch) | |
tree | 396c8be0783ae99922d28fa1b13ab05e76e8a33d /test/lisp/emacs-lisp/bytecomp-tests.el | |
parent | 7de192680fdac6938f5704aea0310b85b0da9c5e (diff) | |
download | emacs-0c55261971b0fea62a8e94204e544ff8af714a2e.tar.gz emacs-0c55261971b0fea62a8e94204e544ff8af714a2e.tar.bz2 emacs-0c55261971b0fea62a8e94204e544ff8af714a2e.zip |
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.
Diffstat (limited to 'test/lisp/emacs-lisp/bytecomp-tests.el')
-rw-r--r-- | test/lisp/emacs-lisp/bytecomp-tests.el | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index 26408e8685a..a943012e5fc 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -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 |