send-email: allow multiple emails using --cc, --to and --bcc
[gitweb.git] / t / t9001-send-email.sh
index 806f06631d10cb50fe2eee2d7faadc01df719083..9aee4747fe7e49a21118b2b3033090cf78b934ee 100755 (executable)
@@ -1648,4 +1648,48 @@ test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=false' '
        do_xmailer_test 1 "--xmailer"
 '
 
+test_expect_success $PREREQ 'setup expected-list' '
+       git send-email \
+       --dry-run \
+       --from="Example <from@example.com>" \
+       --to="To 1 <to1@example.com>" \
+       --to="to2@example.com" \
+       --to="to3@example.com" \
+       --cc="Cc 1 <cc1@example.com>" \
+       --cc="Cc2 <cc2@example.com>" \
+       --bcc="bcc1@example.com" \
+       --bcc="bcc2@example.com" \
+       0001-add-master.patch | replace_variable_fields \
+       >expected-list
+'
+
+test_expect_success $PREREQ 'use email list in --cc --to and --bcc' '
+       git send-email \
+       --dry-run \
+       --from="Example <from@example.com>" \
+       --to="To 1 <to1@example.com>, to2@example.com" \
+       --to="to3@example.com" \
+       --cc="Cc 1 <cc1@example.com>, Cc2 <cc2@example.com>" \
+       --bcc="bcc1@example.com, bcc2@example.com" \
+       0001-add-master.patch | replace_variable_fields \
+       >actual-list &&
+       test_cmp expected-list actual-list
+'
+
+test_expect_success $PREREQ 'aliases work with email list' '
+       echo "alias to2 to2@example.com" >.mutt &&
+       echo "alias cc1 Cc 1 <cc1@example.com>" >>.mutt &&
+       test_config sendemail.aliasesfile ".mutt" &&
+       test_config sendemail.aliasfiletype mutt &&
+       git send-email \
+       --dry-run \
+       --from="Example <from@example.com>" \
+       --to="To 1 <to1@example.com>, to2, to3@example.com" \
+       --cc="cc1, Cc2 <cc2@example.com>" \
+       --bcc="bcc1@example.com, bcc2@example.com" \
+       0001-add-master.patch | replace_variable_fields \
+       >actual-list &&
+       test_cmp expected-list actual-list
+'
+
 test_done