@matheusbsbs / matheus-bagliano / commits / ae00dc191a
Fork 0

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 <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jonathan Nieder committed May 3, 2010 at 21:57 UTC ae00dc191a8da2309a6d7c68a254ede1357d877d
1 file changed +39 -29
t/t4201-shortlog.sh
+39 -29
@@ -8,30 +8,38 @@ test_description='git shortlog
8
9 . ./test-lib.sh
10
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 +'
40
34 -cat > expect << EOF
41 +test_expect_success 'shortlog wrapping' '
42 + cat >expect <<\EOF &&
43 A U Thor (5):
44 Test
45 This is a very, very long first line for the commit message to see if
@@ -44,13 +52,15 @@ A U Thor (5):
52 56 78
53
54 EOF
55 + git shortlog -w HEAD >out &&
56 + test_cmp expect out
57 +'
58
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 +'
64
65 iconvfromutf8toiso88591() {
66 printf "%s" "$*" | iconv -f UTF-8 -t ISO8859-1