Skip to content

Commit ae00dc1

Browse files
jrngitster
authored andcommitted
t4201 (shortlog): guard setup with test_expect_success
Follow the current prevailing style. This also has the benefit of capturing any stray output and noticing if any of the setup commands start failing. Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 02646fe commit ae00dc1

File tree

1 file changed

+39
-29
lines changed

1 file changed

+39
-29
lines changed

t/t4201-shortlog.sh

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,38 @@ test_description='git shortlog
88

99
. ./test-lib.sh
1010

11-
echo 1 > a1
12-
git add a1
13-
tree=$(git write-tree)
14-
commit=$( (echo "Test"; echo) | git commit-tree $tree )
15-
git update-ref HEAD $commit
16-
17-
echo 2 > a1
18-
git commit --quiet -m "This is a very, very long first line for the commit message to see if it is wrapped correctly" a1
19-
20-
# test if the wrapping is still valid when replacing all i's by treble clefs.
21-
echo 3 > a1
22-
git commit --quiet -m "$(echo "This is a very, very long first line for the commit message to see if it is wrapped correctly" | sed "s/i/1234/g" | tr 1234 '\360\235\204\236')" a1
23-
24-
# now fsck up the utf8
25-
git config i18n.commitencoding non-utf-8
26-
echo 4 > a1
27-
git commit --quiet -m "$(echo "This is a very, very long first line for the commit message to see if it is wrapped correctly" | sed "s/i/1234/g" | tr 1234 '\370\235\204\236')" a1
28-
29-
echo 5 > a1
30-
git commit --quiet -m "a 12 34 56 78" a1
31-
32-
git shortlog -w HEAD > out
11+
test_expect_success 'setup' '
12+
echo 1 >a1 &&
13+
git add a1 &&
14+
tree=$(git write-tree) &&
15+
commit=$(printf "%s\n" "Test" "" | git commit-tree "$tree") &&
16+
git update-ref HEAD "$commit" &&
17+
18+
echo 2 >a1 &&
19+
git commit --quiet -m "This is a very, very long first line for the commit message to see if it is wrapped correctly" a1 &&
20+
21+
# test if the wrapping is still valid
22+
# when replacing all is by treble clefs.
23+
echo 3 >a1 &&
24+
git commit --quiet -m "$(
25+
echo "This is a very, very long first line for the commit message to see if it is wrapped correctly" |
26+
sed "s/i/1234/g" |
27+
tr 1234 "\360\235\204\236")" a1 &&
28+
29+
# now fsck up the utf8
30+
git config i18n.commitencoding non-utf-8 &&
31+
echo 4 >a1 &&
32+
git commit --quiet -m "$(
33+
echo "This is a very, very long first line for the commit message to see if it is wrapped correctly" |
34+
sed "s/i/1234/g" |
35+
tr 1234 "\370\235\204\236")" a1 &&
36+
37+
echo 5 >a1 &&
38+
git commit --quiet -m "a 12 34 56 78" a1
39+
'
3340

34-
cat > expect << EOF
41+
test_expect_success 'shortlog wrapping' '
42+
cat >expect <<\EOF &&
3543
A U Thor (5):
3644
Test
3745
This is a very, very long first line for the commit message to see if
@@ -44,13 +52,15 @@ A U Thor (5):
4452
56 78
4553
4654
EOF
55+
git shortlog -w HEAD >out &&
56+
test_cmp expect out
57+
'
4758

48-
test_expect_success 'shortlog wrapping' 'test_cmp expect out'
49-
50-
git log HEAD > log
51-
GIT_DIR=non-existing git shortlog -w < log > out
52-
53-
test_expect_success 'shortlog from non-git directory' 'test_cmp expect out'
59+
test_expect_success 'shortlog from non-git directory' '
60+
git log HEAD >log &&
61+
GIT_DIR=non-existing git shortlog -w <log >out &&
62+
test_cmp expect out
63+
'
5464

5565
iconvfromutf8toiso88591() {
5666
printf "%s" "$*" | iconv -f UTF-8 -t ISO8859-1

0 commit comments

Comments
 (0)