[PATCH 1/4] t7005: sanitize test environment for subsequent tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some of the editor tests manipulate the environment or config in ways
that affect future tests (because they test a sequence of overrides),
but those modifications are visible to future tests and create a footgun
for them. Use test_config and undo environment modifications once
finished.

Signed-off-by: D. Ben Knoble <ben.knoble+github@xxxxxxxxx>
---
 t/t7005-editor.sh | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/t/t7005-editor.sh b/t/t7005-editor.sh
index 5fcf281dfb..06fa1ecd91 100755
--- a/t/t7005-editor.sh
+++ b/t/t7005-editor.sh
@@ -111,6 +111,8 @@
 	'
 done
 
+unset EDITOR VISUAL GIT_EDITOR
+git config --unset-all core.editor
 test_expect_success 'editor with a space' '
 	echo "echo space >\"\$1\"" >"e space.sh" &&
 	chmod a+x "e space.sh" &&
@@ -119,13 +121,10 @@
 
 '
 
-unset GIT_EDITOR
 test_expect_success 'core.editor with a space' '
-
-	git config core.editor \"./e\ space.sh\" &&
+	test_config core.editor \"./e\ space.sh\" &&
 	git commit --amend &&
 	test space = "$(git show -s --pretty=format:%s)"
-
 '
 
 test_done
-- 
2.48.1





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux