Add a basic test case for git send-email, and fix some real bugs discovered.
Signed-off-by: Ryan Anderson <rda@google.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Ryan Anderson committed
May 29, 2006 at 12:30 UTC
ce903018f1ed0283fdaa3de1ec3ad29fccf25c96
1 file changed
+34
t/t9001-send-email.sh
new
+34
@@ -0,0 +1,34 @@
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