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

[PATCH 1/1] [GSoC][PATCH] t3070: refactor test -e command

From
shejialuo <shejialuo@gmail.com>
Date
Feb 29, 2024, 15:04 UTC
Message-ID
<20240229150442.490649-2-shejialuo@gmail.com>
In-Reply-To
<20240229150442.490649-1-shejialuo@gmail.com>

The "test_path_exists" function was proposed at 7e9055b. It provides parameter number check and more robust error messages.

This patch converts all "test -e" into "test_path_exists" to improve test debug when failure.

Signed-off-by: shejialuo <shejialuo@gmail.com>
---
 t/t3070-wildmatch.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/t/t3070-wildmatch.sh b/t/t3070-wildmatch.sh
index 4dd42df38c..d18ddc1a52 100755
--- a/t/t3070-wildmatch.sh
+++ b/t/t3070-wildmatch.sh
@@ -107,7 +107,7 @@ match_with_ls_files() {
 
 	if test "$match_expect" = 'E'
 	then
-		if test -e .git/created_test_file
+		if test_path_exists .git/created_test_file
 		then
 			test_expect_success EXPENSIVE_ON_WINDOWS "$match_function (via ls-files): match dies on '$pattern' '$text'" "
 				printf '%s' '$text' >expect &&
@@ -118,7 +118,7 @@ match_with_ls_files() {
 		fi
 	elif test "$match_expect" = 1
 	then
-		if test -e .git/created_test_file
+		if test_path_exists .git/created_test_file
 		then
 			test_expect_success EXPENSIVE_ON_WINDOWS "$match_function (via ls-files): match '$pattern' '$text'" "
 				printf '%s' '$text' >expect &&
@@ -130,7 +130,7 @@ match_with_ls_files() {
 		fi
 	elif test "$match_expect" = 0
 	then
-		if test -e .git/created_test_file
+		if test_path_exists .git/created_test_file
 		then
 			test_expect_success EXPENSIVE_ON_WINDOWS "$match_function (via ls-files): no match '$pattern' '$text'" "
 				>expect &&
@@ -175,7 +175,7 @@ match() {
 	fi
 
 	test_expect_success EXPENSIVE_ON_WINDOWS 'cleanup after previous file test' '
-		if test -e .git/created_test_file
+		if test_path_exists .git/created_test_file
 		then
 			git reset &&
 			git clean -df
@@ -198,7 +198,7 @@ match() {
 			fi &&
 			git add -A &&
 			printf "%s" "$file" >.git/created_test_file
-		elif test -e .git/created_test_file
+		elif test_path_exists .git/created_test_file
 		then
 			rm .git/created_test_file
 		fi
-- 
2.44.0
Previous: shejialuoNext: Eric Sunshine
Message 2 of 26 in “microproject: Use test_path_is_* functions in test scripts”
  1. shejialuoFeb 29, 2024
  2. 1/1 [GSoC][PATCH] t3070: refactor test -e commandshejialuo, Feb 29, 2024
  3. Eric SunshineFeb 29, 2024
  4. Junio C HamanoFeb 29, 2024
  5. SoC 2024: clarify `test_path_is_*` conversion microprojectPatrick Steinhardt, Mar 4, 2024
  6. Christian CouderMar 4, 2024
  7. Junio C HamanoMar 4, 2024
  8. Patrick SteinhardtMar 4, 2024
  9. shejialuoMar 1, 2024
  10. 0/1 [GSoC][PATCH] t9117: prefer test_path_* helper functionsshejialuo, Mar 1, 2024
  11. 1/1 t9117: prefer test_path_* helper functionsshejialuo, Mar 1, 2024
  12. Eric SunshineMar 1, 2024
  13. shejialuoMar 1, 2024
  14. Junio C HamanoMar 1, 2024
  15. shejialuoMar 1, 2024
  16. 0/1 t9117: prefer test_path_* helper functionsshejialuo, Mar 1, 2024
  17. 1/1 [PATCH] t9117: prefer test_path_* helper functionsshejialuo, Mar 1, 2024
  18. Patrick SteinhardtMar 4, 2024
  19. 0/1 Change commit messageshejialuo, Mar 4, 2024
  20. 1/1 [PATCH] t9117: prefer test_path_* helper functionsshejialuo, Mar 4, 2024
  21. Patrick SteinhardtMar 4, 2024
  22. shejialuoMar 4, 2024
  23. Junio C HamanoMar 4, 2024
  24. Junio C HamanoMar 4, 2024
  25. shejialuoMar 5, 2024
  26. Junio C HamanoMar 4, 2024

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.