t9001: check send-email behavior with implicit sender

We allow send-email to use an implicitly-defined identity for the sender (because there is still a confirmation step), but we abort when we cannot generate such an identity. Let's make sure that we test this. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Nov 28, 2012 at 15:06 UTC 59defcc36839d549a2db94b7569025ea3b4ec01a
1 file changed +28
t/t9001-send-email.sh
+28
@@ -201,6 +201,34 @@ test_expect_success $PREREQ 'Prompting works' '
201 grep "^To: to@example.com\$" msgtxt1
202 '
203
204 +test_expect_success $PREREQ,AUTOIDENT 'implicit ident is allowed' '
205 + clean_fake_sendmail &&
206 + (sane_unset GIT_AUTHOR_NAME &&
207 + sane_unset GIT_AUTHOR_EMAIL &&
208 + sane_unset GIT_COMMITTER_NAME &&
209 + sane_unset GIT_COMMITTER_EMAIL &&
210 + GIT_SEND_EMAIL_NOTTY=1 git send-email \
211 + --smtp-server="$(pwd)/fake.sendmail" \
212 + --to=to@example.com \
213 + $patches </dev/null 2>errors
214 + )
215 +'
216 +
217 +test_expect_success $PREREQ,!AUTOIDENT 'broken implicit ident aborts send-email' '
218 + clean_fake_sendmail &&
219 + (sane_unset GIT_AUTHOR_NAME &&
220 + sane_unset GIT_AUTHOR_EMAIL &&
221 + sane_unset GIT_COMMITTER_NAME &&
222 + sane_unset GIT_COMMITTER_EMAIL &&
223 + GIT_SEND_EMAIL_NOTTY=1 && export GIT_SEND_EMAIL_NOTTY &&
224 + test_must_fail git send-email \
225 + --smtp-server="$(pwd)/fake.sendmail" \
226 + --to=to@example.com \
227 + $patches </dev/null 2>errors &&
228 + test_i18ngrep "tell me who you are" errors
229 + )
230 +'
231 +
232 test_expect_success $PREREQ 'tocmd works' '
233 clean_fake_sendmail &&
234 cp $patches tocmd.patch &&