Skip to content

Commit 8a8bf46

Browse files
peffgitster
authored andcommitted
send-email: test compose functionality
This is just a basic sanity check that --compose works at all. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 6d34a2b commit 8a8bf46

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

t/t9001-send-email.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,33 @@ test_expect_success 'Valid In-Reply-To when prompting' '
137137
! grep "^In-Reply-To: < *>" msgtxt1
138138
'
139139

140+
test_expect_success 'setup fake editor' '
141+
(echo "#!/bin/sh" &&
142+
echo "echo fake edit >>\$1"
143+
) >fake-editor &&
144+
chmod +x fake-editor
145+
'
146+
147+
test_expect_success '--compose works' '
148+
clean_fake_sendmail &&
149+
echo y | \
150+
GIT_EDITOR=$(pwd)/fake-editor \
151+
GIT_SEND_EMAIL_NOTTY=1 \
152+
git send-email \
153+
--compose --subject foo \
154+
--from="Example <nobody@example.com>" \
155+
--to=nobody@example.com \
156+
--smtp-server="$(pwd)/fake.sendmail" \
157+
$patches \
158+
2>errors
159+
'
160+
161+
test_expect_success 'first message is compose text' '
162+
grep "^fake edit" msgtxt1
163+
'
164+
165+
test_expect_success 'second message is patch' '
166+
grep "Subject:.*Second" msgtxt2
167+
'
168+
140169
test_done

0 commit comments

Comments
 (0)