summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@gmail.com>2019-06-04 21:26:06 -0400
committerNoam Postavsky <npostavs@gmail.com>2019-06-10 18:27:22 -0400
commit0026d0bf9f4e4e0247de9c1eb885507608378266 (patch)
treeb330d22ab718de52a60de728cc344485a457d3fb /test/lisp/emacs-lisp
parent03b66d23a863835484267a8085bb9112d9bdecae (diff)
downloademacs-0026d0bf9f4e4e0247de9c1eb885507608378266.tar.gz
emacs-0026d0bf9f4e4e0247de9c1eb885507608378266.tar.bz2
emacs-0026d0bf9f4e4e0247de9c1eb885507608378266.zip
Don't keep warning about unescaped literals (Bug#36068)
* lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Restore lost let-binding of lread--unescaped-character-literals, so that unescaped literals warning will only apply to the form just read. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--unescaped-char-literals): Expand test to check that we don't keep warning about old unescaped literals.
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el32
1 files changed, 19 insertions, 13 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index f45c9209c14..83162d250fc 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -559,19 +559,25 @@ bytecompiled code, and their results compared.")
"Check that byte compiling warns about unescaped character
literals (Bug#20852)."
(should (boundp 'lread--unescaped-character-literals))
- (bytecomp-tests--with-temp-file source
- (write-region "(list ?) ?( ?; ?\" ?[ ?])" nil source)
- (bytecomp-tests--with-temp-file destination
- (let* ((byte-compile-dest-file-function (lambda (_) destination))
- (byte-compile-error-on-warn t)
- (byte-compile-debug t)
- (err (should-error (byte-compile-file source))))
- (should (equal (cdr err)
- (list (concat "unescaped character literals "
- "`?\"', `?(', `?)', `?;', `?[', `?]' "
- "detected, "
- "`?\\\"', `?\\(', `?\\)', `?\\;', `?\\[', "
- "`?\\]' expected!"))))))))
+ (let ((byte-compile-error-on-warn t)
+ (byte-compile-debug t))
+ (bytecomp-tests--with-temp-file source
+ (write-region "(list ?) ?( ?; ?\" ?[ ?])" nil source)
+ (bytecomp-tests--with-temp-file destination
+ (let* ((byte-compile-dest-file-function (lambda (_) destination))
+ (err (should-error (byte-compile-file source))))
+ (should (equal (cdr err)
+ `(,(concat "unescaped character literals "
+ "`?\"', `?(', `?)', `?;', `?[', `?]' "
+ "detected, "
+ "`?\\\"', `?\\(', `?\\)', `?\\;', `?\\[', "
+ "`?\\]' expected!")))))))
+ ;; But don't warn in subsequent compilations (Bug#36068).
+ (bytecomp-tests--with-temp-file source
+ (write-region "(list 1 2 3)" nil source)
+ (bytecomp-tests--with-temp-file destination
+ (let ((byte-compile-dest-file-function (lambda (_) destination)))
+ (should (byte-compile-file source)))))))
(ert-deftest bytecomp-tests--old-style-backquotes ()
"Check that byte compiling warns about old-style backquotes."