send-email: add test for Linux's get_maintainer.pl
We had a regression that broke Linux's get_maintainer.pl. Using Mail::Address to parse email addresses fixed it, but let's protect against future regressions. Note that we need --cc-cmd to be relative because this option doesn't accept spaces in script names (probably to allow --cc-cmd="executable --option"), while --smtp-server needs to be absolute. Patch-edited-by: Matthieu Moy <git@matthieu-moy.fr> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Matthieu Moy <git@matthieu-moy.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Alex Bennée committed
Jan 8, 2018 at 11:34 UTC
d60be8acab06c34886338cbf98f7628284705979
1 file changed
+19
t/t9001-send-email.sh
+19
@@ -172,6 +172,25 @@ test_expect_success $PREREQ 'cc trailer with various syntax' '
172
test_cmp expected-cc commandline1
173
'
174
175
+test_expect_success $PREREQ 'setup fake get_maintainer.pl script for cc trailer' "
176
+ write_script expected-cc-script.sh <<-EOF
177
+ echo 'One Person <one@example.com> (supporter:THIS (FOO/bar))'
178
+ echo 'Two Person <two@example.com> (maintainer:THIS THING)'
179
+ echo 'Third List <three@example.com> (moderated list:THIS THING (FOO/bar))'
180
+ echo '<four@example.com> (moderated list:FOR THING)'
181
+ echo 'five@example.com (open list:FOR THING (FOO/bar))'
182
+ echo 'six@example.com (open list)'
183
+ EOF
184
+"
185
+
186
+test_expect_success $PREREQ 'cc trailer with get_maintainer.pl output' '
187
+ clean_fake_sendmail &&
188
+ git send-email -1 --to=recipient@example.com \
189
+ --cc-cmd=./expected-cc-script.sh \
190
+ --smtp-server="$(pwd)/fake.sendmail" &&
191
+ test_cmp expected-cc commandline1
192
+'
193
+
194
test_expect_success $PREREQ 'setup expect' "
195
cat >expected-show-all-headers <<\EOF
196
0001-Second.patch