From 7d138ff918c837a2e9ea099fa975917826874715 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Tue, 8 Oct 2024 02:31:21 +0200 Subject: [PATCH] Delete temporary directory only if test succeeds --- elisp/runfiles/runfiles-test.el | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/elisp/runfiles/runfiles-test.el b/elisp/runfiles/runfiles-test.el index 0d1d24ab..fc1f4326 100644 --- a/elisp/runfiles/runfiles-test.el +++ b/elisp/runfiles/runfiles-test.el @@ -37,18 +37,17 @@ (should (or (getenv "RUNFILES_DIR") (getenv "RUNFILES_MANIFEST_FILE"))))) (ert-deftest elisp/runfiles/special-chars/directory () - (let ((directory (make-temp-file "runfiles-test-" :directory))) - (unwind-protect - (let ((filename (expand-file-name "testäα𝐴🐈'.txt" directory)) - (runfiles (elisp/runfiles/make :manifest "/invalid.manifest" - :directory directory)) - (coding-system-for-write 'utf-8-unix) - (write-region-annotate-functions nil) - (write-region-post-annotation-function nil)) - (write-region "contents\n" nil filename nil nil nil 'excl) - (should (equal (elisp/runfiles/rlocation "testäα𝐴🐈'.txt" runfiles) - filename))) - (delete-directory directory :recursive)))) + (let* ((directory (make-temp-file "runfiles-test-" :directory)) + (filename (expand-file-name "testäα𝐴🐈'.txt" directory)) + (runfiles (elisp/runfiles/make :manifest "/invalid.manifest" + :directory directory)) + (coding-system-for-write 'utf-8-unix) + (write-region-annotate-functions nil) + (write-region-post-annotation-function nil)) + (write-region "contents\n" nil filename nil nil nil 'excl) + (should (equal (elisp/runfiles/rlocation "testäα𝐴🐈'.txt" runfiles) + filename)) + (delete-directory directory :recursive))) (ert-deftest elisp/runfiles/special-chars/manifest () (let* ((manifest (elisp/runfiles/rlocation