From: Tom Russello <tom.russe...@ensimag.grenoble-inp.fr>

Tests if the "To", "Cc" and "Subject" fields are adequately filled and if the
message is correctly quoted.

Signed-off-by: Tom Russello <tom.russe...@grenoble-inp.org>
Signed-off-by: Samuel Groot <samuel.gr...@grenoble-inp.org>
Signed-off-by: Matthieu Moy <matthieu....@grenoble-inp.fr>

---


diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index b3355d2..bda4018 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -1885,4 +1885,47 @@ test_expect_success $PREREQ 'leading and trailing 
whitespaces are removed' '
        test_cmp expected-list actual-list
 '
 
+test_expect_success $PREREQ 'setup expect' '
+       cat >email <<-\EOF
+       Message-Id: <author_123...@example.com>
+       From: aut...@example.com
+       To: t...@example.com
+       Cc: c...@example.com
+       Date: Sat, 12 Jun 2010 15:53:58 +0200
+       Subject: subject goes here
+
+       Have you seen my previous email?
+       > Previous content
+       EOF
+'
+
+test_expect_success $PREREQ 'From, To, Cc, Subject with --quote-mail are 
correct' '
+       clean_fake_sendmail &&
+       git send-email \
+               --quote-mail=email \
+               --from="Example <nob...@example.com>" \
+               --smtp-server="$(pwd)/fake.sendmail" \
+               -1 \
+               2>errors &&
+       grep "From: Example <nob...@example.com>" msgtxt1 &&
+       to_adr=$(awk "/^To: /,/^Cc: /" msgtxt1) &&
+       echo "$to_adr" | grep aut...@example.com &&
+       echo "$to_adr" | grep t...@example.com &&
+       grep "Cc: c...@example.com" msgtxt1
+'
+test_expect_success $PREREQ 'the message given is quoted with --quote-mail' '
+       grep "> Have you seen my previous email?" msgtxt1 &&
+       grep ">> Previous content" msgtxt1
+'
+test_expect_success $PREREQ 'Check if Re is written, only once with 
--quote-mail' '
+       grep "Subject: Re: subject goes here" msgtxt1 &&
+       git send-email \
+               --quote-mail=msgtxt1 \
+               --from="Example <nob...@example.com>" \
+               --smtp-server="$(pwd)/fake.sendmail" \
+               -1 \
+               2>errors &&
+       grep "Subject: Re: subject goes here" msgtxt3
+'
+
 test_done
-- 
2.8.2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to