From: Jonathan Nieder <jrnieder@gmail.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Frederik Schwarzer" <schwarzerf@gmail.com>,
"Brandon Casey" <drafnel@gmail.com>
Subject: [PATCH 4/7] test: test cherry-pick functionality and output separately
Date: Tue, 13 Mar 2012 00:00:36 -0500 [thread overview]
Message-ID: <20120313050036.GD12550@burratino> (raw)
In-Reply-To: <20120313045100.GA12474@burratino>
Since v1.7.3-rc0~26^2~9 (revert: report success when using option
--strategy, 2010-07-14), the cherry-pick-many-commits test checks the
format of output written to the terminal during a cherry-pick sequence
in addition to the functionality. There is no reason those have to
be checked in the same test, though, and it has some downsides:
- when progress output is broken, the test result does not convey
whether the functionality was also broken or not
- it is not immediately obvious when reading that these checks are
meant to prevent regressions in details of the output format and
are not just a roundabout way to check functional details like the
number of commits produced
- there is a temptation to include the same kind of output checking
for every new cherry-pick test, which would make future changes
to the output unnecessarily difficult
Put the tests from v1.7.3-rc0~26^2~9 in separate assertions, following
the principle "test one feature at a time".
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
t/t3508-cherry-pick-many-commits.sh | 32 +++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/t/t3508-cherry-pick-many-commits.sh b/t/t3508-cherry-pick-many-commits.sh
index d909e6db..75f7ff4f 100755
--- a/t/t3508-cherry-pick-many-commits.sh
+++ b/t/t3508-cherry-pick-many-commits.sh
@@ -35,6 +35,16 @@ test_expect_success setup '
'
test_expect_success 'cherry-pick first..fourth works' '
+ git checkout -f master &&
+ git reset --hard first &&
+ test_tick &&
+ git cherry-pick first..fourth &&
+ git diff --quiet other &&
+ git diff --quiet HEAD other &&
+ check_head_differs_from fourth
+'
+
+test_expect_success 'output to keep user entertained during multi-pick' '
cat <<-\EOF >expected &&
[master OBJID] second
Author: A U Thor <author@example.com>
@@ -51,15 +61,22 @@ test_expect_success 'cherry-pick first..fourth works' '
git reset --hard first &&
test_tick &&
git cherry-pick first..fourth >actual &&
- git diff --quiet other &&
- git diff --quiet HEAD other &&
-
sed -e "s/$_x05[0-9a-f][0-9a-f]/OBJID/" <actual >actual.fuzzy &&
- test_i18ncmp expected actual.fuzzy &&
- check_head_differs_from fourth
+ test_line_count -ge 3 actual.fuzzy &&
+ test_i18ncmp expected actual.fuzzy
'
test_expect_success 'cherry-pick --strategy resolve first..fourth works' '
+ git checkout -f master &&
+ git reset --hard first &&
+ test_tick &&
+ git cherry-pick --strategy resolve first..fourth &&
+ git diff --quiet other &&
+ git diff --quiet HEAD other &&
+ check_head_differs_from fourth
+'
+
+test_expect_success 'output during multi-pick indicates merge strategy' '
cat <<-\EOF >expected &&
Trying simple merge.
[master OBJID] second
@@ -79,11 +96,8 @@ test_expect_success 'cherry-pick --strategy resolve first..fourth works' '
git reset --hard first &&
test_tick &&
git cherry-pick --strategy resolve first..fourth >actual &&
- git diff --quiet other &&
- git diff --quiet HEAD other &&
sed -e "s/$_x05[0-9a-f][0-9a-f]/OBJID/" <actual >actual.fuzzy &&
- test_i18ncmp expected actual.fuzzy &&
- check_head_differs_from fourth
+ test_i18ncmp expected actual.fuzzy
'
test_expect_success 'cherry-pick --ff first..fourth works' '
--
1.7.9.2
next prev parent reply other threads:[~2012-03-13 5:00 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-31 14:24 [PATCH] Correct singular form in diff summary line for human interaction Nguyễn Thái Ngọc Duy
2012-01-31 15:20 ` Jonathan Nieder
2012-01-31 17:50 ` Junio C Hamano
2012-02-01 1:32 ` Nguyen Thai Ngoc Duy
2012-02-01 1:45 ` Thomas Dickey
2012-02-01 1:56 ` Thomas Dickey
2012-02-01 2:37 ` Nguyen Thai Ngoc Duy
2012-02-01 3:04 ` Junio C Hamano
2012-02-01 9:40 ` Thomas Dickey
2012-02-01 12:55 ` [PATCH v2] Use correct grammar in diffstat summary line Nguyễn Thái Ngọc Duy
2012-02-01 21:26 ` Junio C Hamano
2012-02-02 14:22 ` Nguyen Thai Ngoc Duy
2012-02-02 18:24 ` Junio C Hamano
2012-02-03 1:11 ` Nguyen Thai Ngoc Duy
2012-02-03 1:18 ` Junio C Hamano
2012-02-03 12:24 ` Jeff King
2012-02-01 23:35 ` Jonathan Nieder
2012-02-02 0:20 ` [RFC/PATCH] i18n: do not define gettext/ngettext in NO_GETTEXT case Jonathan Nieder
2012-02-02 0:27 ` [PATCH v2] Use correct grammar in diffstat summary line Jonathan Nieder
2012-02-02 0:31 ` Jonathan Nieder
2012-03-13 4:51 ` [RFC/PATCH 0/7] tests: diffstat summary line varies by locale (Re: [PATCH v2] Use correct grammar in diffstat summary line) Jonathan Nieder
2012-03-13 4:54 ` [PATCH 1/7] test: use test_i18ncmp when checking --stat output Jonathan Nieder
2012-03-13 6:00 ` Junio C Hamano
2012-03-13 6:05 ` Junio C Hamano
2012-03-13 6:13 ` Jonathan Nieder
2012-03-13 6:06 ` Jonathan Nieder
2012-03-13 4:58 ` [PATCH 2/7] test: use numstat instead of diffstat in funny-names test Jonathan Nieder
2012-03-13 4:59 ` [PATCH 3/7] test: modernize funny-names test style Jonathan Nieder
2012-03-13 5:00 ` Jonathan Nieder [this message]
2012-03-13 5:01 ` [PATCH 5/7] test: use --numstat instead of --stat in "git stash show" tests Jonathan Nieder
2012-03-13 5:02 ` [PATCH 6/7] test: use numstat instead of diffstat in binary-diff test Jonathan Nieder
2012-03-13 5:05 ` [PATCH 7/7] diffstat summary line varies by locale: miscellany Jonathan Nieder
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=20120313050036.GD12550@burratino \
--to=jrnieder@gmail.com \
--cc=avarab@gmail.com \
--cc=drafnel@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
--cc=schwarzerf@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).