diff options
author | Eric Sunshine <sunshine@sunshineco.com> | 2015-05-31 18:29:30 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-06-01 15:53:13 -0700 |
commit | 514554cf53757298f948e3b53ddb55f7c922bfa1 (patch) | |
tree | 3790975f086fb5c8d64759341323117f4f50e228 /t | |
parent | send-email: implement sendmail aliases line continuation support (diff) | |
download | tgif-514554cf53757298f948e3b53ddb55f7c922bfa1.tar.xz |
t9001: refactor sendmail aliases test infrastructure
Several new tests of sendmail aliases parsing will be added in a
subsequent patch, so factor out functionality common to all of them
into a new helper function.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t9001-send-email.sh | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index a3663da49b..1012fa3ad6 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -1549,10 +1549,35 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' ' grep "^!someone@example\.org!$" commandline1 ' -test_expect_success $PREREQ 'sendemail.aliasfiletype=sendmail' ' - clean_fake_sendmail && rm -fr outdir && - git format-patch -1 -o outdir && - cat >>.tmp-email-aliases <<-\EOF && +test_sendmail_aliases () { + msg="$1" && shift && + expect="$@" && + cat >.tmp-email-aliases && + + test_expect_success $PREREQ "$msg" ' + clean_fake_sendmail && rm -fr outdir && + git format-patch -1 -o outdir && + git config --replace-all sendemail.aliasesfile \ + "$(pwd)/.tmp-email-aliases" && + git config sendemail.aliasfiletype sendmail && + git send-email \ + --from="Example <nobody@example.com>" \ + --to=alice --to=bcgrp \ + --smtp-server="$(pwd)/fake.sendmail" \ + outdir/0001-*.patch \ + 2>errors >out && + for i in $expect + do + grep "^!$i!$" commandline1 || return 1 + done + ' +} + +test_sendmail_aliases 'sendemail.aliasfiletype=sendmail' \ + 'awol@example\.com' \ + 'bob@example\.com' \ + 'chloe@example\.com' \ + 'o@example\.com' <<-\EOF alice: Alice W Land <awol@example.com> bob: Robert Bobbyton <bob@example.com> # this is a comment @@ -1561,20 +1586,6 @@ test_expect_success $PREREQ 'sendemail.aliasfiletype=sendmail' ' abgroup: alice, bob bcgrp: bob, chloe, Other <o@example.com> EOF - git config --replace-all sendemail.aliasesfile \ - "$(pwd)/.tmp-email-aliases" && - git config sendemail.aliasfiletype sendmail && - git send-email \ - --from="Example <nobody@example.com>" \ - --to=alice --to=bcgrp \ - --smtp-server="$(pwd)/fake.sendmail" \ - outdir/0001-*.patch \ - 2>errors >out && - grep "^!awol@example\.com!$" commandline1 && - grep "^!bob@example\.com!$" commandline1 && - grep "^!chloe@example\.com!$" commandline1 && - grep "^!o@example\.com!$" commandline1 -' do_xmailer_test () { expected=$1 params=$2 && |