aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorRyan Anderson <rda@google.com>2006-05-29 12:30:15 -0700
committerJunio C Hamano <junkio@cox.net>2006-05-29 23:15:37 -0700
commitce903018f1ed0283fdaa3de1ec3ad29fccf25c96 (patch)
tree6c332f40e66fe30e99b20a1ea331e16df39a2627 /t
parent8baf06a03aa2a4554079a2f722af1751f1654ce8 (diff)
downloadgit-ce903018f1ed0283fdaa3de1ec3ad29fccf25c96.tar.gz
git-ce903018f1ed0283fdaa3de1ec3ad29fccf25c96.tar.xz
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>
Diffstat (limited to 't')
-rwxr-xr-xt/t9001-send-email.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
new file mode 100755
index 000000000..276cbac3b
--- /dev/null
+++ b/t/t9001-send-email.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+test_description='git-send-email'
+. ./test-lib.sh
+
+PROG='git send-email'
+test_expect_success \
+ 'prepare reference tree' \
+ 'echo "1A quick brown fox jumps over the" >file &&
+ echo "lazy dog" >>file &&
+ git add file
+ GIT_AUTHOR_NAME="A" git commit -a -m "Initial."'
+
+test_expect_success \
+ 'Setup helper tool' \
+ 'echo "#!/bin/sh" > fake.sendmail
+ echo "shift" >> fake.sendmail
+ echo "echo \"\$*\" > commandline" >> fake.sendmail
+ echo "cat > msgtxt" >> fake.sendmail
+ chmod +x ./fake.sendmail
+ git add fake.sendmail
+ GIT_AUTHOR_NAME="A" git commit -a -m "Second."'
+
+test_expect_success \
+ 'Extract patches and send' \
+ 'git format-patch -n HEAD^1
+ git send-email -from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" ./0001*txt'
+
+test_expect_success \
+ 'Verify commandline' \
+ 'cline=$(cat commandline)
+ [ "$cline" == "nobody@example.com author@example.com" ]'
+
+test_done