aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index e8feec31d26..3624904753c 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -506,6 +506,29 @@ bytecompiled code, and their results compared.")
506 (dolist (pat bytecomp-lexbind-tests) 506 (dolist (pat bytecomp-lexbind-tests)
507 (should (bytecomp-lexbind-check-1 pat)))) 507 (should (bytecomp-lexbind-check-1 pat))))
508 508
509(defmacro bytecomp-tests--with-temp-file (file-name-var &rest body)
510 (declare (indent 1))
511 (cl-check-type file-name-var symbol)
512 `(let ((,file-name-var (make-temp-file "emacs")))
513 (unwind-protect
514 (progn ,@body)
515 (delete-file ,file-name-var))))
516
517(ert-deftest bytecomp-tests--unescaped-char-literals ()
518 "Check that byte compiling warns about unescaped character
519literals (Bug#20852)."
520 (should (boundp 'lread--unescaped-character-literals))
521 (bytecomp-tests--with-temp-file source
522 (write-region "(list ?) ?( ?; ?\" ?[ ?])" nil source)
523 (bytecomp-tests--with-temp-file destination
524 (let* ((byte-compile-dest-file-function (lambda (_) destination))
525 (byte-compile-error-on-warn t)
526 (byte-compile-debug t)
527 (err (should-error (byte-compile-file source))))
528 (should (equal (cdr err)
529 (list (concat "unescaped character literals "
530 "\", (, ), ;, [, ] detected!"))))))))
531
509;; Local Variables: 532;; Local Variables:
510;; no-byte-compile: t 533;; no-byte-compile: t
511;; End: 534;; End: