* 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.
(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
(ert-with-temp-directory dir
(setq saved dir)
(should (file-exists-p dir))
- (should (file-directory-p dir)))
+ (should (file-directory-p dir))
+ (should (equal dir (file-name-as-directory dir))))
(should-not (file-exists-p saved))))
(ert-deftest ert-x-tests-with-temp-directory/text-signals-error ()