git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v4] t1300: use test helpers instead of test builtins

From
Pushkar Singh <pushkarkumarsingh1970@gmail.com>
Date
Jan 4, 2026, 19:47 UTC
Message-ID
<20260104194812.15134-1-pushkarkumarsingh1970@gmail.com>
In-Reply-To
<20260104124255.15609-1-pushkarkumarsingh1970@gmail.com>

Replace test -f and test -h checks with test_path_is_file and test_path_is_symlink. Using the test framework helpers provides clearer diagnostics and keeps tests consistent across the suite.

Signed-off-by: Pushkar Singh <pushkarkumarsingh1970@gmail.com>
---
Changes in v4:
- Update commit message to avoid calling `test` a shell primitive
- No code changes
 t/t1300-config.sh             | 8 ++++----
 t/t2021-checkout-overwrite.sh | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/t/t1300-config.sh b/t/t1300-config.sh
index 358d636379..9850fcd5b5 100755
--- a/t/t1300-config.sh
+++ b/t/t1300-config.sh
@@ -1232,12 +1232,12 @@ test_expect_success SYMLINKS 'symlinked configuration' '
 	test_when_finished "rm myconfig" &&
 	ln -s notyet myconfig &&
 	git config --file=myconfig test.frotz nitfol &&
-	test -h myconfig &&
-	test -f notyet &&
+	test_path_is_symlink myconfig &&
+	test_path_is_file notyet &&
 	test "z$(git config --file=notyet test.frotz)" = znitfol &&
 	git config --file=myconfig test.xyzzy rezrov &&
-	test -h myconfig &&
-	test -f notyet &&
+	test_path_is_symlink myconfig &&
+	test_path_is_file notyet &&
 	cat >expect <<-\EOF &&
 	nitfol
 	rezrov
diff --git a/t/t2021-checkout-overwrite.sh b/t/t2021-checkout-overwrite.sh
index a5c03d5d4a..38c41ae373 100755
--- a/t/t2021-checkout-overwrite.sh
+++ b/t/t2021-checkout-overwrite.sh
@@ -27,7 +27,7 @@ test_expect_success 'checkout commit with dir must not remove untracked a/b' '
 	git rm --cached a/b &&
 	git commit -m "un-track the file" &&
 	test_must_fail git checkout start &&
-	test -f a/b
+	test_path_is_file a/b
 '
 
 test_expect_success 'create a commit where dir a/b changed to symlink' '
@@ -49,7 +49,7 @@ test_expect_success 'checkout commit with dir must not remove untracked a/b' '
 
 test_expect_success SYMLINKS 'the symlink remained' '
 
-	test -h a/b
+	test_path_is_symlink a/b
 '
 
 test_expect_success 'cleanup after previous symlink tests' '
-- 
2.43.0
Previous: Samuel AbrahamNext: Karthik Nayak
Message 10 of 11 in “t1300: use test helpers instead of shell primitives”
  1. t1300: use test helpers instead of shell primitivespushkarkumarsingh1970@gmail.com, Jan 2, 2026
  2. Karthik NayakJan 2, 2026
  3. Pushkar SinghJan 2, 2026
  4. Junio C HamanoJan 4, 2026
  5. t1300: use test helpers instead of test builtinsPushkar Singh, Jan 4, 2026
  6. t1300: use test helpers instead of test builtinsAbraham Samuel Adekunle, Jan 4, 2026
  7. Pushkar SinghJan 4, 2026
  8. Karthik NayakJan 5, 2026
  9. Samuel AbrahamJan 5, 2026
  10. t1300: use test helpers instead of test builtinsPushkar Singh, Jan 4, 2026
  11. Karthik NayakJan 5, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.