From 8fb268720e8565885039e7491f4628974e2d66a2 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 20 Mar 2015 06:06:15 -0400 Subject: t: fix severe &&-chain breakage These are tests which are missing a link in their &&-chain, in a location which causes a significant portion of the test to be missed (e.g., the test effectively does nothing, or consists of a long string of actions and output comparisons, and we throw away the exit code of at least one part of the string). Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t4202-log.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/t4202-log.sh') diff --git a/t/t4202-log.sh b/t/t4202-log.sh index 5f2b290d2b..a22ac7c75a 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -481,7 +481,7 @@ test_expect_success 'log.decorate configuration' ' git log --oneline --no-decorate >actual && test_cmp expect.none actual && git log --oneline --decorate >actual && - test_cmp expect.short actual + test_cmp expect.short actual && test_unconfig log.decorate && git log --pretty=raw >expect.raw && -- cgit v1.2.1 From a167ece0c8cd9470427f8e9a1b43b27303eefa75 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 20 Mar 2015 06:09:00 -0400 Subject: 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 Signed-off-by: Junio C Hamano --- t/t4202-log.sh | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) (limited to 't/t4202-log.sh') diff --git a/t/t4202-log.sh b/t/t4202-log.sh index a22ac7c75a..85230a87b4 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" ' -- cgit v1.2.1