summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
diff options
context:
space:
mode:
authorPhilipp Stephani <phst@google.com>2020-12-17 12:06:15 +0100
committerPhilipp Stephani <phst@google.com>2020-12-17 12:19:27 +0100
commit7fad9591142f9d9d0bfce37dd8c65a847dbe8aa9 (patch)
tree09d68c7f148cd96f22317dd889420c25ea0c0304 /test/lisp/emacs-lisp
parent32d76c0cbc32aa8740bf742a0aea05dd92d28275 (diff)
downloademacs-7fad9591142f9d9d0bfce37dd8c65a847dbe8aa9.tar.gz
emacs-7fad9591142f9d9d0bfce37dd8c65a847dbe8aa9.tar.bz2
emacs-7fad9591142f9d9d0bfce37dd8c65a847dbe8aa9.zip
Ensure that byte compilation works for relative files (Bug#45287).
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don’t fail if target filename doesn’t contain a directory name. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--target-file-no-directory): New unit test.
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index c2a3e3ba117..4a6e28f7c7c 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -1016,6 +1016,21 @@ mountpoint (Bug#44631)."
(set-file-modes directory #o700)
(delete-directory directory :recursive))))))
+(ert-deftest bytecomp-tests--target-file-no-directory ()
+ "Check that Bug#45287 is fixed."
+ (let ((directory (make-temp-file "bytecomp-tests-" :directory)))
+ (unwind-protect
+ (let* ((default-directory directory)
+ (byte-compile-dest-file-function (lambda (_) "test.elc"))
+ (byte-compile-error-on-warn t))
+ (write-region "" nil "test.el" nil nil nil 'excl)
+ (should (byte-compile-file "test.el"))
+ (should (file-regular-p "test.elc"))
+ (should (cl-plusp (file-attribute-size
+ (file-attributes "test.elc")))))
+ (with-demoted-errors "Error cleaning up directory: %s"
+ (delete-directory directory :recursive)))))
+
;; Local Variables:
;; no-byte-compile: t
;; End: