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

[PATCH 1/3] t1300: use test_must_fail as appropriate

From
Jeff King <peff@peff.net>
Date
Mar 7, 2009, 17:14 UTC
Message-ID
<1236446046-18319-2-git-send-email-peff@peff.net>
In-Reply-To
<1236446046-18319-1-git-send-email-peff@peff.net>

Some of the tests checked the exit code manually, even going so far as to run git outside of the test_expect harness.

Signed-off-by: Jeff King <peff@peff.net>
---
Just a cleanup I noticed when one of the tests failed for me.
 t/t1300-repo-config.sh |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 11b82f4..3c06842 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -336,10 +336,10 @@ test_expect_success 'get bool variable with empty value' \
 	'git config --bool emptyvalue.variable > output &&
 	 cmp output expect'
 
-git config > output 2>&1
-
-test_expect_success 'no arguments, but no crash' \
-	"test $? = 129 && grep usage output"
+test_expect_success 'no arguments, but no crash' '
+	test_must_fail git config >output 2>&1 &&
+	grep usage output
+'
 
 cat > .git/config << EOF
 [a.b]
@@ -373,7 +373,7 @@ EOF
 test_expect_success 'new variable inserts into proper section' 'cmp .git/config expect'
 
 test_expect_success 'alternative GIT_CONFIG (non-existing file should fail)' \
-	'git config --file non-existing-config -l; test $? != 0'
+	'test_must_fail git config --file non-existing-config -l'
 
 cat > other-config << EOF
 [ein]
-- 
1.6.2.195.g44251.dirty
Previous: Jeff KingNext: Jeff King
Message 2 of 9 in “config --bool-or-int fixes”
  1. 0/3 config --bool-or-int fixesJeff King, Mar 7, 2009
  2. 1/3 t1300: use test_must_fail as appropriateJeff King, Mar 7, 2009
  3. 2/3 config: set help text for --bool-or-intJeff King, Mar 7, 2009
  4. Felipe ContrerasMar 7, 2009
  5. Jeff KingMar 7, 2009
  6. Felipe ContrerasMar 9, 2009
  7. Jeff KingMar 10, 2009
  8. 3/3 document config --bool-or-intJeff King, Mar 7, 2009
  9. Jeff KingMar 7, 2009

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.