git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Samuel GROOT <samuel.groot@grenoble-inp.org>
Cc: git@vger.kernel.org, tom.russello@grenoble-inp.org,
	erwan.mathoniere@grenoble-inp.org,
	jordan.de-gea@grenoble-inp.org, matthieu.moy@grenoble-inp.fr,
	aaron@schrab.com, e@80x24.org
Subject: Re: [PATCH v4 1/6] t9001: non order-sensitive file comparison
Date: Wed, 08 Jun 2016 10:17:08 -0700	[thread overview]
Message-ID: <xmqqmvmvmwh7.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20160608130142.29879-2-samuel.groot@grenoble-inp.org> (Samuel GROOT's message of "Wed, 8 Jun 2016 15:01:37 +0200")

Samuel GROOT <samuel.groot@grenoble-inp.org> writes:

> @@ -97,7 +104,7 @@ test_expect_success $PREREQ 'setup expect' '
>  '
>  
>  test_expect_success $PREREQ 'Verify commandline' '
> -	test_cmp expected commandline1
> +	test_cmp_noorder expected commandline1
>  '
>  
>  test_expect_success $PREREQ 'Send patches with --envelope-sender' '

By the way, don't you find it irritating to review this patch that
has three hunks, all of which look like the above?  You cannot
easily tell which 3 among 27 instances of test_cmp are modified,
because the hunks do not give useful context.

This is not at all your fault, but because the existing tests are
structured poorly.  It separates one logical step into three pieces
without a good reason.

Here is an illustration of an organization that I think would be
easier to read, and would result in a more readable patch when
modification is made on top.  The first two hunks collapse the
overall "setup" steps that appear as three separate tests into a
single "setup" test.  The last hunk that begin at -83/+79 collapses
a logically-single test that is split across three into one, and
makes the order of things done in the test to (1) set an
expectation, (2) execute the command and (3) compare the result with
the expectation.

I am not going to commit this myself, because I do not want to
create conflicts with the change your topic is trying to do, and
besides, almost all the remainder of the tests follow "one logical
test split into three" pattern and need to be corrected before this
"illustration" can become a real patch.

I do not mind if you take it and complete it as a preliminary
clean-up step in your series; or you can "keep it in mind, but
ignore it for now", in which case this can be a "low hanging fruit"
somebody else, hopefully somebody new to the development community,
can use to dip their toes ;-)



 t/t9001-send-email.sh | 33 ++++++++++++++-------------------
 1 file changed, 14 insertions(+), 19 deletions(-)

diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index b3355d2..858bdbe 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -6,14 +6,16 @@ test_description='git send-email'
 # May be altered later in the test
 PREREQ="PERL"
 
-test_expect_success $PREREQ 'prepare reference tree' '
+clean_fake_sendmail () {
+	rm -f commandline* msgtxt*
+}
+
+test_expect_success $PREREQ 'setup' '
 	echo "1A quick brown fox jumps over the" >file &&
 	echo "lazy dog" >>file &&
 	git add file &&
-	GIT_AUTHOR_NAME="A" git commit -a -m "Initial."
-'
+	GIT_AUTHOR_NAME="A" git commit -a -m "Initial." &&
 
-test_expect_success $PREREQ 'Setup helper tool' '
 	write_script fake.sendmail <<-\EOF &&
 	shift
 	output=1
@@ -28,14 +30,8 @@ test_expect_success $PREREQ 'Setup helper tool' '
 	cat >"msgtxt$output"
 	EOF
 	git add fake.sendmail &&
-	GIT_AUTHOR_NAME="A" git commit -a -m "Second."
-'
-
-clean_fake_sendmail () {
-	rm -f commandline* msgtxt*
-}
+	GIT_AUTHOR_NAME="A" git commit -a -m "Second." &&
 
-test_expect_success $PREREQ 'Extract patches' '
 	patches=$(git format-patch -s --cc="One <one@example.com>" --cc=two@example.com -n HEAD^1)
 '
 
@@ -83,20 +79,19 @@ test_expect_success $PREREQ 'No confirm with sendemail.confirm=never' '
 	check_no_confirm
 '
 
-test_expect_success $PREREQ 'Send patches' '
-	git send-email --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
-'
-
-test_expect_success $PREREQ 'setup expect' '
-	cat >expected <<-\EOF
+test_expect_success $PREREQ 'with --suppress-cc=sob --from and --to' '
+	cat >expected <<-\EOF &&
 	!nobody@example.com!
 	!author@example.com!
 	!one@example.com!
 	!two@example.com!
 	EOF
-'
 
-test_expect_success $PREREQ 'Verify commandline' '
+	git send-email --suppress-cc=sob \
+		--from="Example <nobody@example.com>" \
+		--to=nobody@example.com \
+		--smtp-server="$(pwd)/fake.sendmail" $patches 2>errors &&
+
 	test_cmp expected commandline1
 '
 

  parent reply	other threads:[~2016-06-08 17:17 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-23 19:30 [RFC-PATCH 0/2] send-email: new --quote-mail option Tom Russello
2016-05-23 19:30 ` [RFC-PATCH 1/2] send-email: new option to quote an email and reply to Tom Russello
2016-05-23 19:55   ` Eric Wong
2016-05-23 20:07     ` Matthieu Moy
2016-05-23 22:10       ` Samuel GROOT
2016-05-24 12:43     ` Samuel GROOT
2016-05-24 12:49       ` Matthieu Moy
2016-05-24 22:30         ` Aaron Schrab
2016-05-25  0:04           ` Tom Russello
2016-05-24 21:23       ` Eric Wong
2016-05-23 20:00   ` Matthieu Moy
2016-05-24 23:31     ` Samuel GROOT
2016-05-25  6:29       ` Matthieu Moy
2016-05-25 15:40         ` Junio C Hamano
2016-05-25 16:56           ` Matthieu Moy
2016-05-25 18:15             ` Junio C Hamano
2016-05-25 18:31               ` Matthieu Moy
2016-05-26  0:08                 ` Samuel GROOT
2016-05-27  9:06                   ` Matthieu Moy
2016-05-23 19:30 ` [RFC-PATCH 2/2] t9001: adding --quote-mail option test Tom Russello
2016-05-23 20:05   ` Matthieu Moy
2016-05-23 19:38 ` [RFC-PATCH 0/2] send-email: new --quote-mail option Matthieu Moy
2016-05-23 19:56   ` Samuel GROOT
2016-05-27 17:11 ` [RFC-PATCH v2 0/2] send-email: new --quote-email option Tom Russello
2016-05-27 17:11   ` [RFC-PATCH v2 1/2] send-email: quote-email populates the fields Tom Russello
2016-05-28 14:35     ` Matthieu Moy
2016-05-29 23:38       ` Tom Russello
2016-05-27 17:11   ` [RFC-PATCH v2 2/2] send-email: quote-email quotes the message body Tom Russello
2016-05-28 15:01     ` Matthieu Moy
2016-05-29 11:41       ` Tom Russello
2016-06-07 14:01   ` [PATCH v3 0/6] send-email: cleaner tests and quote email Tom Russello
2016-06-07 14:01     ` [PATCH v3 1/6] t9001: non order-sensitive file comparison Tom Russello
2016-06-08  1:07       ` Junio C Hamano
2016-06-08  8:23         ` Samuel GROOT
2016-06-08 16:09           ` Junio C Hamano
2016-06-08 16:46             ` Samuel GROOT
2016-06-09  6:01               ` Matthieu Moy
2016-06-13 22:21                 ` Samuel GROOT
2016-06-09  5:51         ` Matthieu Moy
2016-06-09  8:15           ` Tom Russello
2016-06-07 14:01     ` [PATCH v3 2/6] t9001: check email address is in Cc: field Tom Russello
2016-06-09  5:55       ` Matthieu Moy
2016-06-13 22:23         ` Samuel GROOT
2016-06-07 14:01     ` [PATCH v3 3/6] t9001: shorten send-email's output Tom Russello
2016-06-08  8:36       ` Eric Wong
2016-06-08  9:30         ` Samuel GROOT
2016-06-09  6:03       ` Matthieu Moy
2016-06-07 14:01     ` [PATCH v3 4/6] send-email: create email parser subroutine Tom Russello
2016-06-07 14:05       ` [PATCH v3 5/6] send-email: --in-reply-to=<file> populates the fields Tom Russello
2016-06-07 14:05         ` [PATCH v3 6/6] send-email: add option --cite to quote the message body Tom Russello
2016-06-08 13:01     ` (unknown), Samuel GROOT
2016-06-08 13:01       ` [PATCH v4 1/6] t9001: non order-sensitive file comparison Samuel GROOT
2016-06-08 14:22         ` Remi Galan Alfonso
2016-06-08 14:29           ` Samuel GROOT
2016-06-08 16:56         ` Junio C Hamano
2016-06-08 19:21           ` Samuel GROOT
2016-06-08 17:17         ` Junio C Hamano [this message]
2016-06-08 19:19           ` Samuel GROOT
2016-06-08 13:01       ` [PATCH v4 2/6] t9001: check email address is in Cc: field Samuel GROOT
2016-06-08 17:34         ` Junio C Hamano
2016-06-08 19:23           ` Samuel GROOT
2016-06-08 13:01       ` [PATCH v4 3/6] send-email: shorten send-email's output Samuel GROOT
2016-06-08 17:37         ` Junio C Hamano
2016-06-08 19:18           ` Samuel GROOT
2016-06-08 19:33             ` Junio C Hamano
2016-06-08 19:40               ` Samuel GROOT
2016-06-09  6:17         ` Matthieu Moy
2016-06-13 22:19           ` Samuel GROOT
2016-06-08 13:01       ` [PATCH v4 4/6] send-email: create email parser subroutine Samuel GROOT
2016-06-08 17:58         ` Junio C Hamano
2016-06-08 18:12           ` Eric Sunshine
2016-06-08 18:32             ` Junio C Hamano
2016-06-08 19:26               ` Samuel GROOT
2016-06-08 19:31                 ` Junio C Hamano
2016-06-08 19:42                   ` Samuel GROOT
2016-06-08 19:30             ` Samuel GROOT
2016-06-08 20:13               ` Eric Sunshine
2016-06-08 20:17                 ` Junio C Hamano
2016-06-08 23:54                   ` Samuel GROOT
2016-06-09  0:21                     ` Eric Wong
2016-06-13 22:18                       ` Samuel GROOT
2016-06-13 22:47                         ` Eric Wong
2016-06-14 22:18                           ` Samuel GROOT
2016-06-09  6:51                     ` Eric Sunshine
2016-06-13 22:15                       ` Samuel GROOT
2016-06-08 19:36           ` Samuel GROOT
2016-06-08 20:38         ` Eric Wong
2016-06-08 13:07       ` [PATCH v4 5/6] send-email: --in-reply-to=<file> populate header fields Samuel GROOT
2016-06-08 18:23         ` Junio C Hamano
2016-06-14 22:26           ` Samuel GROOT
2016-06-09  9:45         ` Matthieu Moy
2016-06-14 22:35           ` Samuel GROOT
2016-06-08 13:08       ` [PATCH v4 6/6] send-email: add option --cite to quote the message body Samuel GROOT
2016-06-09 11:49         ` Matthieu Moy
2016-06-14 22:53           ` Samuel GROOT
2016-06-15 22:21           ` Tom Russello

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqmvmvmwh7.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=aaron@schrab.com \
    --cc=e@80x24.org \
    --cc=erwan.mathoniere@grenoble-inp.org \
    --cc=git@vger.kernel.org \
    --cc=jordan.de-gea@grenoble-inp.org \
    --cc=matthieu.moy@grenoble-inp.fr \
    --cc=samuel.groot@grenoble-inp.org \
    --cc=tom.russello@grenoble-inp.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).