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

[PATCH 5/6] test-lib.sh: Add check for invalid use of 'skip_all' facility

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Sep 1, 2012, 18:13 UTC
Message-ID
<5042503F.7040101@ramsay1.demon.co.uk>

The 'skip_all' facility cannot be used after one or more tests have been executed using (for example) 'test_expect_success'. To do so results in invalid TAP output, which leads to 'prove' complaining of "Parse errors: No plan found in TAP output".

Add a check for such invalid usage and abort the test with an error message to alert the test author.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 t/test-lib.sh | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 56b028c..283d27a 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -383,6 +383,10 @@ test_done () {
 	case "$test_failure" in
 	0)
 		# Maybe print SKIP message
+		if test -n "$skip_all" && test $test_count -gt 0
+		then
+			error "Can't use skip_all after running some tests"
+		fi
 		[ -z "$skip_all" ] || skip_all=" # SKIP $skip_all"
 
 		if test $test_external_has_tap -eq 0
-- 
1.7.12
Message 1 of 1 in “test-lib.sh: Add check for invalid use of 'skip_all' facility”
  1. 5/6 test-lib.sh: Add check for invalid use of 'skip_all' facilityRamsay 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.