summaryrefslogtreecommitdiff
path: root/t/t4202-log.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-03-20 10:09:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-03-20 17:20:15 (GMT)
commita167ece0c8cd9470427f8e9a1b43b27303eefa75 (patch)
treed302d080642c0655d2778ef32f82838df986aea4 /t/t4202-log.sh
parent5ca812a19c97a2cbfe797748bc9bf6ebde9e0f64 (diff)
downloadgit-a167ece0c8cd9470427f8e9a1b43b27303eefa75.zip
git-a167ece0c8cd9470427f8e9a1b43b27303eefa75.tar.gz
git-a167ece0c8cd9470427f8e9a1b43b27303eefa75.tar.bz2
t: use verbose instead of hand-rolled errors
Many tests that predate the "verbose" helper function use a pattern like: test ... || { echo ... false } to give more verbose output. Using the helper, we can do this with a single line, and avoid a || which interacts badly with &&-chaining (besides fooling --chain-lint, we hit the error block no matter which command in the chain failed, so we may often show useless results). In most cases, the messages printed by "verbose" are equally good (in some cases better; t6006 accidentally redirects the message to a file!). The exception is t7001, whose output suffers slightly. However, it's still enough to show the user which part failed, given that we will have just printed the test script to stderr. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4202-log.sh')
-rwxr-xr-xt/t4202-log.sh30
1 files changed, 5 insertions, 25 deletions
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index a22ac7c..85230a8 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -113,11 +113,7 @@ test_expect_success 'diff-filter=M' '
actual=$(git log --pretty="format:%s" --diff-filter=M HEAD) &&
expect=$(echo second) &&
- test "$actual" = "$expect" || {
- echo Oops
- echo "Actual: $actual"
- false
- }
+ verbose test "$actual" = "$expect"
'
@@ -125,11 +121,7 @@ test_expect_success 'diff-filter=D' '
actual=$(git log --pretty="format:%s" --diff-filter=D HEAD) &&
expect=$(echo sixth ; echo third) &&
- test "$actual" = "$expect" || {
- echo Oops
- echo "Actual: $actual"
- false
- }
+ verbose test "$actual" = "$expect"
'
@@ -137,11 +129,7 @@ test_expect_success 'diff-filter=R' '
actual=$(git log -M --pretty="format:%s" --diff-filter=R HEAD) &&
expect=$(echo third) &&
- test "$actual" = "$expect" || {
- echo Oops
- echo "Actual: $actual"
- false
- }
+ verbose test "$actual" = "$expect"
'
@@ -149,11 +137,7 @@ test_expect_success 'diff-filter=C' '
actual=$(git log -C -C --pretty="format:%s" --diff-filter=C HEAD) &&
expect=$(echo fourth) &&
- test "$actual" = "$expect" || {
- echo Oops
- echo "Actual: $actual"
- false
- }
+ verbose test "$actual" = "$expect"
'
@@ -161,11 +145,7 @@ test_expect_success 'git log --follow' '
actual=$(git log --follow --pretty="format:%s" ichi) &&
expect=$(echo third ; echo second ; echo initial) &&
- test "$actual" = "$expect" || {
- echo Oops
- echo "Actual: $actual"
- false
- }
+ verbose test "$actual" = "$expect"
'