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

[PATCH] t3505: fix abuse of test_expect_code

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 21, 2009, 09:14 UTC
Message-ID
<7v7hz6t0d2.fsf@alter.siamese.dyndns.org>

The test wanted to make sure that cherry-pick exits with status 1, but with the way it was placed after "git checkout master &&" meant that it could have misjudged success if checkout barfed with the same failure status.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 * Besides, /bin/sh (but not bash) on FreeBSD 7.2 does not seem to
   evaluate "a && b" fed to test_expect_code correctly for me (eval_ret=0
   for some reason, even though cherry-pick was failing), and this patch
   incidentally fixes that issue.
 t/t3505-cherry-pick-empty.sh |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/t/t3505-cherry-pick-empty.sh b/t/t3505-cherry-pick-empty.sh
index 9aaeabd..e51e505 100755
--- a/t/t3505-cherry-pick-empty.sh
+++ b/t/t3505-cherry-pick-empty.sh
@@ -17,11 +17,11 @@ test_expect_success setup '
 
 '
 
-test_expect_code 1 'cherry-pick an empty commit' '
-
-	git checkout master &&
-	git cherry-pick empty-branch
-
+test_expect_success 'cherry-pick an empty commit' '
+	git checkout master && {
+		git cherry-pick empty-branch
+		test "$?" = 1
+	}
 '
 
 test_expect_success 'index lockfile was removed' '
Message 1 of 1 in “t3505: fix abuse of test_expect_code”
  1. t3505: fix abuse of test_expect_codeJunio C Hamano, Jun 21, 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.