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

[PATCH 1/2] t5318: use 'test_must_be_empty'

From
Taylor Blau <me@ttaylorr.com>
Date
Jun 1, 2020, 18:01 UTC
Message-ID
<fddbe588147444fe2675224c94f50e24a1d12871.1591034353.git.me@ttaylorr.com>
In-Reply-To
<cover.1591034353.git.me@ttaylorr.com>

A handful of tests in t5318 use 'test_line_count = 0 ...' to make sure that some command does not write any output. While correct, it is more helpful to use 'test_must_be_empty' instead, since the latter prints the contents of the file if it is non-empty.

Since 'test_line_count' only prints the expected and actual line count, not the contents, using 'test_must_be_empty' may be more helpful for debugging if there is regression in any of these tests.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
 t/t5318-commit-graph.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh
index a79c624875..d23986f603 100755
--- a/t/t5318-commit-graph.sh
+++ b/t/t5318-commit-graph.sh
@@ -147,7 +147,7 @@ test_expect_success 'Add more commits' '
 test_expect_success 'commit-graph write progress off for redirected stderr' '
 	cd "$TRASH_DIRECTORY/full" &&
 	git commit-graph write 2>err &&
-	test_line_count = 0 err
+	test_must_be_empty err
 '
 
 test_expect_success 'commit-graph write force progress on for stderr' '
@@ -159,13 +159,13 @@ test_expect_success 'commit-graph write force progress on for stderr' '
 test_expect_success 'commit-graph write with the --no-progress option' '
 	cd "$TRASH_DIRECTORY/full" &&
 	git commit-graph write --no-progress 2>err &&
-	test_line_count = 0 err
+	test_must_be_empty err
 '
 
 test_expect_success 'commit-graph verify progress off for redirected stderr' '
 	cd "$TRASH_DIRECTORY/full" &&
 	git commit-graph verify 2>err &&
-	test_line_count = 0 err
+	test_must_be_empty err
 '
 
 test_expect_success 'commit-graph verify force progress on for stderr' '
@@ -177,7 +177,7 @@ test_expect_success 'commit-graph verify force progress on for stderr' '
 test_expect_success 'commit-graph verify with the --no-progress option' '
 	cd "$TRASH_DIRECTORY/full" &&
 	git commit-graph verify --no-progress 2>err &&
-	test_line_count = 0 err
+	test_must_be_empty err
 '
 
 # Current graph structure:
-- 
2.26.2.1052.gcc6b3749ab
Previous: Taylor BlauNext: SZEDER Gábor
Message 2 of 7 in “t5318: test '--stdin-commits' with '--[no-]progress'”
  1. 0/2 t5318: test '--stdin-commits' with '--[no-]progress'Taylor Blau, Jun 1, 2020
  2. 1/2 t5318: use 'test_must_be_empty'Taylor Blau, Jun 1, 2020
  3. SZEDER GáborJun 2, 2020
  4. Taylor BlauJun 3, 2020
  5. 2/2 t5318: test that '--stdin-commits' respects '--[no-]progress'Taylor Blau, Jun 1, 2020
  6. Derrick StoleeJun 1, 2020
  7. Taylor BlauJun 1, 2020

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.