Skip to content

Commit 4b705f4

Browse files
committed
t8001: check the exit status of the command being tested
Avoid running the command being tested as an upstream of a pipe; doing so will lose its exit status. While at it, modernise the style of the script. Signed-off-by: Junio C Hamano <[email protected]>
1 parent e039011 commit 4b705f4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

t/t8001-annotate.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ test_description='git annotate'
66
PROG='git annotate'
77
. "$TEST_DIRECTORY"/annotate-tests.sh
88

9-
test_expect_success \
10-
'Annotating an old revision works' \
11-
'[ $(git annotate file master | awk "{print \$3}" | grep -c "^A$") -eq 2 ] && \
12-
[ $(git annotate file master | awk "{print \$3}" | grep -c "^B$") -eq 2 ]'
13-
9+
test_expect_success 'Annotating an old revision works' '
10+
git annotate file master >result &&
11+
awk "{ print \$3; }" <result >authors &&
12+
test 2 = $(grep A <authors | wc -l) &&
13+
test 2 = $(grep B <authors | wc -l)
14+
'
1415

1516
test_done

0 commit comments

Comments
 (0)