From: Jonathan Nieder <jrnieder@gmail•com>
To: Will Palmer <wmpalmer@gmail•com>
Cc: Junio C Hamano <gitster@pobox•com>, git@vger•kernel.org
Subject: [PATCH 2/5] t4201 (shortlog): guard setup with test_expect_success
Date: Mon, 3 May 2010 21:57:36 -0500 [thread overview]
Message-ID: <20100504025736.GC7322@progeny.tock> (raw)
In-Reply-To: <20100504025217.GA7322@progeny.tock>
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>
---
As before.
t/t4201-shortlog.sh | 68 +++++++++++++++++++++++++++++---------------------
1 files changed, 39 insertions(+), 29 deletions(-)
diff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh
index a01e55b..438a826 100755
--- a/t/t4201-shortlog.sh
+++ b/t/t4201-shortlog.sh
@@ -8,30 +8,38 @@ test_description='git shortlog
. ./test-lib.sh
-echo 1 > a1
-git add a1
-tree=$(git write-tree)
-commit=$( (echo "Test"; echo) | git commit-tree $tree )
-git update-ref HEAD $commit
-
-echo 2 > a1
-git commit --quiet -m "This is a very, very long first line for the commit message to see if it is wrapped correctly" a1
-
-# test if the wrapping is still valid when replacing all i's by treble clefs.
-echo 3 > a1
-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
-
-# now fsck up the utf8
-git config i18n.commitencoding non-utf-8
-echo 4 > a1
-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
-
-echo 5 > a1
-git commit --quiet -m "a 12 34 56 78" a1
-
-git shortlog -w HEAD > out
+test_expect_success 'setup' '
+ echo 1 >a1 &&
+ git add a1 &&
+ tree=$(git write-tree) &&
+ commit=$(printf "%s\n" "Test" "" | git commit-tree "$tree") &&
+ git update-ref HEAD "$commit" &&
+
+ echo 2 >a1 &&
+ git commit --quiet -m "This is a very, very long first line for the commit message to see if it is wrapped correctly" a1 &&
+
+ # test if the wrapping is still valid
+ # when replacing all is by treble clefs.
+ echo 3 >a1 &&
+ 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 &&
+
+ # now fsck up the utf8
+ git config i18n.commitencoding non-utf-8 &&
+ echo 4 >a1 &&
+ 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 &&
+
+ echo 5 >a1 &&
+ git commit --quiet -m "a 12 34 56 78" a1
+'
-cat > expect << EOF
+test_expect_success 'shortlog wrapping' '
+ cat >expect <<\EOF &&
A U Thor (5):
Test
This is a very, very long first line for the commit message to see if
@@ -44,13 +52,15 @@ A U Thor (5):
56 78
EOF
+ git shortlog -w HEAD >out &&
+ test_cmp expect out
+'
-test_expect_success 'shortlog wrapping' 'test_cmp expect out'
-
-git log HEAD > log
-GIT_DIR=non-existing git shortlog -w < log > out
-
-test_expect_success 'shortlog from non-git directory' 'test_cmp expect out'
+test_expect_success 'shortlog from non-git directory' '
+ git log HEAD >log &&
+ GIT_DIR=non-existing git shortlog -w <log >out &&
+ test_cmp expect out
+'
iconvfromutf8toiso88591() {
printf "%s" "$*" | iconv -f UTF-8 -t ISO8859-1
--
1.6.5
next prev parent reply other threads:[~2010-05-04 2:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-02 16:12 What's cooking in git.git (May 2010, #01; Sun, 2) Junio C Hamano
2010-05-02 20:01 ` Johannes Sixt
2010-05-08 15:13 ` [PATCH 1/2] Have set_try_to_free_routine return the previous routine Johannes Sixt
2010-05-08 15:18 ` [PATCH 2/2] Do not call release_pack_memory in malloc wrappers when GIT_TRACE is used Johannes Sixt
2010-05-03 12:48 ` What's cooking in git.git (May 2010, #01; Sun, 2) Jakub Narebski
2010-05-03 18:54 ` Will Palmer
2010-05-04 0:25 ` jn/shortlog (Re: What's cooking in git.git (May 2010, #01; Sun, 2)) Jonathan Nieder
2010-05-04 1:56 ` jn/shortlog Jonathan Nieder
2010-05-04 2:52 ` [PATCH v2 0/5] jn/shortlog Jonathan Nieder
2010-05-04 2:57 ` [PATCH 1/5] Documentation/shortlog: scripted users should not rely on implicit HEAD Jonathan Nieder
2010-05-04 2:57 ` Jonathan Nieder [this message]
2010-05-04 2:58 ` [PATCH 3/5] t4201 (shortlog): Test output format with multiple authors Jonathan Nieder
2010-05-04 2:59 ` [PATCH 4/5] shortlog: Document and test --format option Jonathan Nieder
2010-05-04 3:18 ` [PATCH 5/5] pretty: Respect --abbrev option Jonathan Nieder
2010-05-04 8:34 ` Jonathan Nieder
2010-05-08 16:43 ` What's cooking in git.git (May 2010, #01; Sun, 2) Clemens Buchacher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100504025736.GC7322@progeny.tock \
--to=jrnieder@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
--cc=wmpalmer@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox