From f5ed8ded9d0169b159280a7aad5baf5c1e4e1371 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mattias=20Engdeg=C3=A5rd?= Date: Fri, 28 Aug 2020 10:26:32 +0200 Subject: [PATCH] * test/src/fileio-tests.el: Preserve HOME when a test fails --- test/src/fileio-tests.el | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el index ba160681470..7baa4c7e2fa 100644 --- a/test/src/fileio-tests.el +++ b/test/src/fileio-tests.el @@ -98,26 +98,24 @@ Also check that an encoding error can appear in a symlink." (ert-deftest fileio-tests--relative-HOME () "Test that expand-file-name works even when HOME is relative." - (let ((old-home (getenv "HOME"))) + (let ((process-environment (copy-sequence process-environment))) (setenv "HOME" "a/b/c") (should (equal (expand-file-name "~/foo") (expand-file-name "a/b/c/foo"))) (when (memq system-type '(ms-dos windows-nt)) ;; Test expansion of drive-relative file names. (setenv "HOME" "x:foo") - (should (equal (expand-file-name "~/bar") "x:/foo/bar"))) - (setenv "HOME" old-home))) + (should (equal (expand-file-name "~/bar") "x:/foo/bar"))))) (ert-deftest fileio-tests--HOME-trailing-slash () "Test that expand-file-name of \"~\" respects trailing slash." - (let ((old-home (getenv "HOME"))) + (let ((process-environment (copy-sequence process-environment))) (dolist (home (if (memq system-type '(windows-nt ms-dos)) '("c:/a/b/c" "c:/a/b/c/") '("/a/b/c" "/a/b/c/"))) (setenv "HOME" home) - (should (equal (expand-file-name "~") (expand-file-name home)))) - (setenv "HOME" old-home))) + (should (equal (expand-file-name "~") (expand-file-name home)))))) (ert-deftest fileio-tests--expand-file-name-trailing-slash () (dolist (fooslashalias '("foo/" "foo//" "foo/." "foo//." "foo///././." -- 2.39.2