X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/ff42cedd45f18681498c5e380329cdaff2cecf0d..3dccdc9bf6d5b2e72a982187f5f947b20f24fc87:/t/t1900-mail.sh diff --git a/t/t1900-mail.sh b/t/t1900-mail.sh index 6a950b4..cea6769 100755 --- a/t/t1900-mail.sh +++ b/t/t1900-mail.sh @@ -6,6 +6,7 @@ test_description='Test the mail command' test_expect_success \ 'Initialize the StGIT repository' \ ' + git config stgit.sender "A U Thor " && for i in 1 2 3 4 5; do touch foo.txt && echo "line $i" >> foo.txt && @@ -28,7 +29,55 @@ test_expect_success \ stg pop -a && stg import -M mbox0 && t2=$(git cat-file -p $(stg id) | grep ^tree) && - [ "$t1" == "$t2" ] + [ "$t1" = "$t2" ] + ' + +test_expect_success \ + 'Put all the patches in an mbox with patch attachments' \ + 'stg mail --to="Inge Ström " -a -m \ + -t ../../templates/mailattch.tmpl > mbox1' + +test_expect_success \ + 'Import the mbox containing patch attachments and compare' \ + ' + t1=$(git cat-file -p $(stg id) | grep ^tree) + stg pop -a && + stg import -M mbox1 && + t2=$(git cat-file -p $(stg id) | grep ^tree) && + [ "$t1" = "$t2" ] + ' + +test_expect_success \ + 'Check the To:, Cc: and Bcc: headers' \ + ' + stg mail --to=a@a --cc="b@b, c@c" --bcc=d@d $(stg top) -m \ + -t ../../templates/patchmail.tmpl > mbox && + test "$(cat mbox | grep -e "^To:")" = "To: a@a" && + test "$(cat mbox | grep -e "^Cc:")" = "Cc: b@b, c@c" && + test "$(cat mbox | grep -e "^Bcc:")" = "Bcc: d@d" + ' + +test_expect_success \ + 'Check the --auto option' \ + ' + stg edit --sign && + stg mail --to=a@a --cc="b@b, c@c" --bcc=d@d --auto $(stg top) -m \ + -t ../../templates/patchmail.tmpl > mbox && + test "$(cat mbox | grep -e "^To:")" = "To: a@a" && + test "$(cat mbox | grep -e "^Cc:")" = \ + "Cc: C O Mitter , b@b, c@c" && + test "$(cat mbox | grep -e "^Bcc:")" = "Bcc: d@d" + ' + +test_expect_success \ + 'Check the e-mail address duplicates' \ + ' + stg mail --to="a@a, b b " --cc="b@b, c@c" \ + --bcc="c@c, d@d, committer@example.com" --auto $(stg top) -m \ + -t ../../templates/patchmail.tmpl > mbox && + test "$(cat mbox | grep -e "^To:")" = "To: b b , a@a" && + test "$(cat mbox | grep -e "^Cc:")" = "Cc: c@c" && + test "$(cat mbox | grep -e "^Bcc:")" = "Bcc: committer@example.com, d@d" ' test_done