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

[PATCH] t0008: make test "set -e" clean

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 24, 2026, 18:20 UTC
Message-ID
<xmqqh5q5ytq0.fsf_-_@gitster.g>
In-Reply-To
<xmqqcy0t178a.fsf_-_@gitster.g>

In order to catch mistakes like misspelling "test_expect_success", we would like to eventually be able to run our test suite with the "-e" option on.

A piece of script used "grep" to filter out its input purely for its output, but of course, "grep" reports with its exit value when it did not see any hits, which didn't mesh quite well with "set -e".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t0008-ignores.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git i/t/t0008-ignores.sh w/t/t0008-ignores.sh
index db8bde280e..8edb08d9c2 100755
--- i/t/t0008-ignores.sh
+++ w/t/t0008-ignores.sh
@@ -122,7 +122,7 @@ test_expect_success_multiple () {
 	fi
 	testname="$1" expect_all="$2" code="$3"
 
-	expect_verbose=$( echo "$expect_all" | grep -v '^::	' )
+	expect_verbose=$( echo "$expect_all" | grep -v '^::	' ) || :
 	expect=$( echo "$expect_verbose" | sed -e 's/.*	//' )
 
 	test_expect_success $prereq "$testname${no_index_opt:+ with $no_index_opt}" '
Previous: Jeff KingNext: Junio C Hamano
Message 12 of 16 in “t4014: fix call to `test_expect_success ()`”
  1. t4014: fix call to `test_expect_success ()`Patrick Steinhardt, Mar 24, 2026
  2. Mirko FainaMar 24, 2026
  3. Junio C HamanoMar 24, 2026
  4. Mirko FainaMar 24, 2026
  5. Junio C HamanoMar 24, 2026
  6. Re* [PATCH] t4014: fix call to `test_expect_success ()`Junio C Hamano, Mar 24, 2026
  7. t6002: make test "set -e" cleanJunio C Hamano, Mar 24, 2026
  8. test-lib: catch misspelt 'test_expect_successo'Junio C Hamano, Mar 24, 2026
  9. Jeff KingMar 24, 2026
  10. Junio C HamanoMar 24, 2026
  11. Jeff KingMar 25, 2026
  12. t0008: make test "set -e" cleanJunio C Hamano, Mar 24, 2026
  13. t7450: make test "set -e" cleanJunio C Hamano, Mar 24, 2026
  14. Eric SunshineMar 24, 2026
  15. Junio C HamanoMar 24, 2026
  16. Patrick SteinhardtMar 25, 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.