Function: ert-with-temp-directory
ert-with-temp-directory is a macro defined in ert-x.el.gz.
Signature
(ert-with-temp-directory NAME &rest BODY)
Documentation
Bind NAME to the name of a new temporary directory and evaluate BODY.
Delete the temporary directory after BODY exits normally or non-locally.
NAME is bound to the directory name, not the directory file name. (In other words, it will end with the directory delimiter; on Unix-like systems, it will end with "/".)
The same keyword arguments are supported as in
ert-with-temp-file (which see), except for :text.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/ert-x.el.gz
(defmacro ert-with-temp-directory (name &rest body)
"Bind NAME to the name of a new temporary directory and evaluate BODY.
Delete the temporary directory after BODY exits normally or
non-locally.
NAME is bound to the directory name, not the directory file
name. (In other words, it will end with the directory delimiter;
on Unix-like systems, it will end with \"/\".)
The same keyword arguments are supported as in
`ert-with-temp-file' (which see), except for :text."
(declare (indent 1) (debug (symbolp body)))
(let ((tail body) keyw)
(while (keywordp (setq keyw (car tail)))
(setq tail (cddr tail))
(pcase keyw (:text (error "Invalid keyword for directory: :text")))))
`(ert-with-temp-file ,name
:directory t
,@body))