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

[PATCH 6/6] test-lib.sh: Suppress the "passed all ..." message if no tests run

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Sep 1, 2012, 18:26 UTC
Message-ID
<5042534D.3030600@ramsay1.demon.co.uk>

If a test script issues a test_done without executing any tests, for example when using the 'skip_all' facility, the output looks something like this:

    $ ./t9159-git-svn-no-parent-mergeinfo.sh
    # passed all 0 test(s)
    1..0 # SKIP skipping git svn tests, svn not found
    $

The "passed all 0 test(s)" comment line, while correct, looks a little strange. Add a check to suppress this message if no tests have actually been run.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
Hi Junio,

I suspect some people would disagree with this one. Indeed, this only irritates me when I'm feeling grumpy (so most days then). :-D It's clearly not important (I just happened to be making changes in this area), so drop this one if you feel it's not justified.

ATB, Ramsay Jones

 t/test-lib.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 283d27a..f8e3733 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -391,7 +391,10 @@ test_done () {
 
 		if test $test_external_has_tap -eq 0
 		then
-			say_color pass "# passed all $msg"
+			if test $test_count -gt 0
+			then
+				say_color pass "# passed all $msg"
+			fi
 			say "1..$test_count$skip_all"
 		fi
 
-- 
1.7.12
Message 1 of 1 in “test-lib.sh: Suppress the "passed all ..." message if no tests run”
  1. 6/6 test-lib.sh: Suppress the "passed all ..." message if no tests runRamsay Jones, Sep 1, 2012

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.