From 0cac4598a77028a64dde9df74c76549cf48a19f2 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 7 Nov 2021 00:41:14 +0100 Subject: Ensure return value of ert-with-temp-directory * lisp/emacs-lisp/ert-x.el (ert-with-temp-file): Ensure return value when :directory is t is the directory name. * test/lisp/emacs-lisp/ert-x-tests.el (ert-x-tests-with-temp-directory): Extend test for the above. --- lisp/emacs-lisp/ert-x.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el index 752ac3bfdd4..ffeead4179d 100644 --- a/lisp/emacs-lisp/ert-x.el +++ b/lisp/emacs-lisp/ert-x.el @@ -445,7 +445,9 @@ See also `ert-with-temp-directory'." (or (macroexp-file-name) buffer-file-name))))) `(let* ((,temp-file (,(if directory 'file-name-as-directory 'identity) (make-temp-file ,prefix ,directory ,suffix ,text))) - (,name ,temp-file)) + (,name ,(if directory + `(file-name-as-directory ,temp-file) + temp-file))) (unwind-protect (progn ,@body) (ignore-errors -- cgit v1.2.3