aboutsummaryrefslogtreecommitdiff
path: root/t/t9001-send-email.sh
diff options
context:
space:
mode:
authorJay Soffian <jaysoffian@gmail.com>2009-03-28 21:39:11 -0400
committerJunio C Hamano <gitster@pobox.com>2009-03-29 21:41:28 -0700
commitc18f75a1e96ff0f028edf94effd10cf56d892f22 (patch)
treee932b40aa02309c563ff8282929225bcb92bce5d /t/t9001-send-email.sh
parent6e1825186bd052fc1f77b7c8c9a31fbb9a67d90c (diff)
downloadgit-c18f75a1e96ff0f028edf94effd10cf56d892f22.tar.gz
git-c18f75a1e96ff0f028edf94effd10cf56d892f22.tar.xz
send-email: add tests for refactored prompting
Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9001-send-email.sh')
-rwxr-xr-xt/t9001-send-email.sh52
1 files changed, 48 insertions, 4 deletions
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index e426c96fb..b4de98c1f 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -421,8 +421,8 @@ test_confirm () {
--from="Example <nobody@example.com>" \
--to=nobody@example.com \
--smtp-server="$(pwd)/fake.sendmail" \
- $@ \
- $patches | grep "Send this email"
+ $@ $patches > stdout &&
+ grep "Send this email" stdout
}
test_expect_success '--confirm=always' '
@@ -444,8 +444,10 @@ test_expect_success '--confirm=compose' '
test_expect_success 'confirm by default (due to cc)' '
CONFIRM=$(git config --get sendemail.confirm) &&
git config --unset sendemail.confirm &&
- test_confirm &&
- git config sendemail.confirm $CONFIRM
+ test_confirm
+ ret="$?"
+ git config sendemail.confirm ${CONFIRM:-never}
+ test $ret = "0"
'
test_expect_success 'confirm by default (due to --compose)' '
@@ -457,6 +459,48 @@ test_expect_success 'confirm by default (due to --compose)' '
test $ret = "0"
'
+test_expect_success 'confirm detects EOF (inform assumes y)' '
+ CONFIRM=$(git config --get sendemail.confirm) &&
+ git config --unset sendemail.confirm &&
+ GIT_SEND_EMAIL_NOTTY=1 \
+ git send-email \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ $patches < /dev/null
+ ret="$?"
+ git config sendemail.confirm ${CONFIRM:-never}
+ test $ret = "0"
+'
+
+test_expect_success 'confirm detects EOF (auto causes failure)' '
+ CONFIRM=$(git config --get sendemail.confirm) &&
+ git config sendemail.confirm auto &&
+ GIT_SEND_EMAIL_NOTTY=1 \
+ test_must_fail git send-email \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ $patches < /dev/null
+ ret="$?"
+ git config sendemail.confirm ${CONFIRM:-never}
+ test $ret = "0"
+'
+
+test_expect_success 'confirm doesnt loop forever' '
+ CONFIRM=$(git config --get sendemail.confirm) &&
+ git config sendemail.confirm auto &&
+ yes "bogus" | GIT_SEND_EMAIL_NOTTY=1 \
+ test_must_fail git send-email \
+ --from="Example <nobody@example.com>" \
+ --to=nobody@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ $patches
+ ret="$?"
+ git config sendemail.confirm ${CONFIRM:-never}
+ test $ret = "0"
+'
+
test_expect_success '--compose adds MIME for utf8 body' '
clean_fake_sendmail &&
(echo "#!$SHELL_PATH" &&