git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Phil Pennock <phil@pennock-tech.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH 1/2] t4205: drop top-level &&-chaining
Date: Wed, 27 Jul 2016 14:55:02 -0400	[thread overview]
Message-ID: <20160727185501.GA6626@sigill.intra.peff.net> (raw)
In-Reply-To: <20160727185256.GA11657@sigill.intra.peff.net>

The test currently does something like:

  do_one() &&
  do_two() &&
  test_expect_success ...

We generally avoid performing actions at the top-level of
the script (outside of a test_expect block) for two reasons:

  1. The test harness is not checking and reporting if they
     fail.

  2. Their output is not handled correctly (not hidden by
     default, nor shown with "-v").

Using &&-chains seems like it should help with (1), but it
doesn't. If either of the commands fails, we simply skip
running the follow-on test entirely, and the test harness
has no idea.

We can fix this by pushing that setup into its own block.
It _could_ go into the following test block, but since the
result in this case is used by multiple tests, it's more
clear to mark it explicitly as a distinct setup step.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/t4205-log-pretty-formats.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index d9f6242..d6518fa 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -504,8 +504,10 @@ test_expect_success 'ISO and ISO-strict date formats display the same values' '
 '
 
 # get new digests (with no abbreviations)
-head1=$(git rev-parse --verify HEAD~0) &&
-head2=$(git rev-parse --verify HEAD~1) &&
+test_expect_success 'set up log decoration tests' '
+	head1=$(git rev-parse --verify HEAD~0) &&
+	head2=$(git rev-parse --verify HEAD~1)
+'
 
 test_expect_success 'log decoration properly follows tag chain' '
 	git tag -a tag1 -m tag1 &&
-- 
2.9.2.607.g98dce7b


  reply	other threads:[~2016-07-27 18:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-27  8:14 [PATCH] pretty format string support for reflog times Phil Pennock
2016-07-27 12:02 ` Phil Pennock
2016-07-27 13:58 ` Jeff King
2016-07-27 14:17   ` Phil Pennock
2016-07-27 17:18   ` Junio C Hamano
2016-07-27 17:39     ` Jeff King
2016-07-27 18:09       ` Junio C Hamano
2016-07-27 18:17         ` Jeff King
2016-07-27 17:46     ` Junio C Hamano
2016-07-27 17:58       ` Jeff King
2016-07-27 17:56 ` Jeff King
2016-07-27 18:13   ` Phil Pennock
2016-07-27 18:32     ` Jeff King
2016-07-27 18:41       ` Phil Pennock
2016-07-27 19:16         ` Jeff King
2016-07-27 18:52       ` [PATCH 0/2] t4205 style fixes Jeff King
2016-07-27 18:55         ` Jeff King [this message]
2016-07-27 18:55         ` [PATCH 2/2] t4205: indent here documents Jeff King
2016-07-27 19:28           ` Junio C Hamano
2016-07-27 19:57             ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160727185501.GA6626@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=phil@pennock-tech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).