Subject: [PATCH 1/1] t9117: prefer test_path_* helper functions

From: shejialuo <[email-masked]>
Date: Fri, 1 Mar 2024 11:46:06 +0800

test -(e|f|d) does not provide a nice error message when we hit test
failures, so use test_path_exists, test_path_is_dir and
test_path_is_file instead.

Signed-off-by: shejialuo <[email-masked]>
---
 t/t9117-git-svn-init-clone.sh | 40 +++++++++++++++++------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/t/t9117-git-svn-init-clone.sh b/t/t9117-git-svn-init-clone.sh
index 62de819a44..2f964f66aa 100755
--- a/t/t9117-git-svn-init-clone.sh
+++ b/t/t9117-git-svn-init-clone.sh
@@ -15,39 +15,39 @@ test_expect_success 'setup svnrepo' '
 	'
 
 test_expect_success 'basic clone' '
-	test ! -d trunk &&
+	! test_path_is_dir trunk &&
 	git svn clone "$svnrepo"/project/trunk &&
-	test -d trunk/.git/svn &&
-	test -e trunk/foo &&
+	test_path_is_dir trunk/.git/svn &&
+	test_path_exists trunk/foo &&
 	rm -rf trunk
 	'
 
 test_expect_success 'clone to target directory' '
-	test ! -d target &&
+	! test_path_is_dir target &&
 	git svn clone "$svnrepo"/project/trunk target &&
-	test -d target/.git/svn &&
-	test -e target/foo &&
+	test_path_is_dir target/.git/svn &&
+	test_path_exists target/foo &&
 	rm -rf target
 	'
 
 test_expect_success 'clone with --stdlayout' '
-	test ! -d project &&
+	! test_path_is_dir project &&
 	git svn clone -s "$svnrepo"/project &&
-	test -d project/.git/svn &&
-	test -e project/foo &&
+	test_path_is_dir project/.git/svn &&
+	test_path_exists project/foo &&
 	rm -rf project
 	'
 
 test_expect_success 'clone to target directory with --stdlayout' '
-	test ! -d target &&
+	! test_path_is_dir target &&
 	git svn clone -s "$svnrepo"/project target &&
-	test -d target/.git/svn &&
-	test -e target/foo &&
+	test_path_is_dir target/.git/svn &&
+	test_path_exists target/foo &&
 	rm -rf target
 	'
 
 test_expect_success 'init without -s/-T/-b/-t does not warn' '
-	test ! -d trunk &&
+	! test_path_is_dir trunk &&
 	git svn init "$svnrepo"/project/trunk trunk 2>warning &&
 	! grep -q prefix warning &&
 	rm -rf trunk &&
@@ -55,7 +55,7 @@ test_expect_success 'init without -s/-T/-b/-t does not warn' '
 	'
 
 test_expect_success 'clone without -s/-T/-b/-t does not warn' '
-	test ! -d trunk &&
+	! test_path_is_dir trunk &&
 	git svn clone "$svnrepo"/project/trunk 2>warning &&
 	! grep -q prefix warning &&
 	rm -rf trunk &&
@@ -69,7 +69,7 @@ project/trunk:refs/remotes/${prefix}trunk
 project/branches/*:refs/remotes/${prefix}*
 project/tags/*:refs/remotes/${prefix}tags/*
 EOF
-	test ! -f actual &&
+	! test_path_is_file actual &&
 	git --git-dir=project/.git config svn-remote.svn.fetch >>actual &&
 	git --git-dir=project/.git config svn-remote.svn.branches >>actual &&
 	git --git-dir=project/.git config svn-remote.svn.tags >>actual &&
@@ -78,7 +78,7 @@ EOF
 }
 
 test_expect_success 'init with -s/-T/-b/-t assumes --prefix=origin/' '
-	test ! -d project &&
+	! test_path_is_dir project &&
 	git svn init -s "$svnrepo"/project project 2>warning &&
 	! grep -q prefix warning &&
 	test_svn_configured_prefix "origin/" &&
@@ -87,7 +87,7 @@ test_expect_success 'init with -s/-T/-b/-t assumes --prefix=origin/' '
 	'
 
 test_expect_success 'clone with -s/-T/-b/-t assumes --prefix=origin/' '
-	test ! -d project &&
+	! test_path_is_dir project &&
 	git svn clone -s "$svnrepo"/project 2>warning &&
 	! grep -q prefix warning &&
 	test_svn_configured_prefix "origin/" &&
@@ -96,7 +96,7 @@ test_expect_success 'clone with -s/-T/-b/-t assumes --prefix=origin/' '
 	'
 
 test_expect_success 'init with -s/-T/-b/-t and --prefix "" still works' '
-	test ! -d project &&
+	! test_path_is_dir project &&
 	git svn init -s "$svnrepo"/project project --prefix "" 2>warning &&
 	! grep -q prefix warning &&
 	test_svn_configured_prefix "" &&
@@ -105,7 +105,7 @@ test_expect_success 'init with -s/-T/-b/-t and --prefix "" still works' '
 	'
 
 test_expect_success 'clone with -s/-T/-b/-t and --prefix "" still works' '
-	test ! -d project &&
+	! test_path_is_dir project &&
 	git svn clone -s "$svnrepo"/project --prefix "" 2>warning &&
 	! grep -q prefix warning &&
 	test_svn_configured_prefix "" &&
@@ -114,7 +114,7 @@ test_expect_success 'clone with -s/-T/-b/-t and --prefix "" still works' '
 	'
 
 test_expect_success 'init with -T as a full url works' '
-	test ! -d project &&
+	! test_path_is_dir project &&
 	git svn init -T "$svnrepo"/project/trunk project &&
 	rm -rf project
 	'
-- 
2.44.0