276cbac3ba0a863ff0292d19c75e2ff8f844c740
[git.git] / t / t9001-send-email.sh
1 #!/bin/sh
2
3 test_description='git-send-email'
4 . ./test-lib.sh
5
6 PROG='git send-email'
7 test_expect_success \
8     'prepare reference tree' \
9     'echo "1A quick brown fox jumps over the" >file &&
10      echo "lazy dog" >>file &&
11      git add file
12      GIT_AUTHOR_NAME="A" git commit -a -m "Initial."'
13
14 test_expect_success \
15     'Setup helper tool' \
16     'echo "#!/bin/sh" > fake.sendmail
17      echo "shift" >> fake.sendmail
18      echo "echo \"\$*\" > commandline" >> fake.sendmail
19      echo "cat > msgtxt" >> fake.sendmail
20      chmod +x ./fake.sendmail
21      git add fake.sendmail
22      GIT_AUTHOR_NAME="A" git commit -a -m "Second."'
23
24 test_expect_success \
25     'Extract patches and send' \
26     'git format-patch -n HEAD^1
27      git send-email -from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" ./0001*txt'
28
29 test_expect_success \
30     'Verify commandline' \
31     'cline=$(cat commandline)
32      [ "$cline" == "nobody@example.com author@example.com" ]'
33
34 test_done