1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-01 01:41:01 -08:00

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.
This commit is contained in:
Noam Postavsky 2019-06-04 21:26:06 -04:00
parent 03b66d23a8
commit 0026d0bf9f
2 changed files with 22 additions and 15 deletions

View file

@ -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."