GIT 1.5.5-rc2
[gitweb.git] / t / t9001-send-email.sh
index 49750480077ce3dcbd814afd81520d804081bc74..c0973b4e6ee2c6a55d1573e2341607c4adfcbb10 100755 (executable)
@@ -81,7 +81,7 @@ test_expect_success 'Show all headers' '
                -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
                -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \
                >actual-show-all-headers &&
-       diff -u expected-show-all-headers actual-show-all-headers
+       test_cmp expected-show-all-headers actual-show-all-headers
 '
 
 z8=zzzzzzzz
@@ -137,4 +137,33 @@ test_expect_success 'Valid In-Reply-To when prompting' '
        ! grep "^In-Reply-To: < *>" msgtxt1
 '
 
+test_expect_success 'setup fake editor' '
+       (echo "#!/bin/sh" &&
+        echo "echo fake edit >>\$1"
+       ) >fake-editor &&
+       chmod +x fake-editor
+'
+
+test_expect_success '--compose works' '
+       clean_fake_sendmail &&
+       echo y | \
+               GIT_EDITOR=$(pwd)/fake-editor \
+               GIT_SEND_EMAIL_NOTTY=1 \
+               git send-email \
+               --compose --subject foo \
+               --from="Example <nobody@example.com>" \
+               --to=nobody@example.com \
+               --smtp-server="$(pwd)/fake.sendmail" \
+               $patches \
+               2>errors
+'
+
+test_expect_success 'first message is compose text' '
+       grep "^fake edit" msgtxt1
+'
+
+test_expect_success 'second message is patch' '
+       grep "Subject:.*Second" msgtxt2
+'
+
 test_done