t/send-email.sh: add test for suppress-cc=self

This adds a basic test for --suppress-cc=self option of git send-email. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael S. Tsirkin committed May 30, 2013 at 10:11 UTC 5adcf2c69989884ad6c51df0f9ad5e68f6a3f650
1 file changed +43
t/t9001-send-email.sh
+43
@@ -171,6 +171,49 @@ Result: OK
171 EOF
172 "
173
174 +test_suppress_self () {
175 + test_commit $3 &&
176 + test_when_finished "git reset --hard HEAD^" &&
177 +
178 + write_script cccmd-sed <<-EOF &&
179 + sed -n -e s/^cccmd--//p "\$1"
180 + EOF
181 +
182 + git commit --amend --author="$1 <$2>" -F - &&
183 + clean_fake_sendmail &&
184 + git format-patch --stdout -1 >"suppress-self-$3.patch" &&
185 +
186 + git send-email --from="$1 <$2>" \
187 + --to=nobody@example.com \
188 + --cc-cmd=./cccmd-sed \
189 + --suppress-cc=self \
190 + --smtp-server="$(pwd)/fake.sendmail" \
191 + suppress-self-$3.patch &&
192 +
193 + mv msgtxt1 msgtxt1-$3 &&
194 + sed -e '/^$/q' msgtxt1-$3 >"msghdr1-$3" &&
195 + >"expected-no-cc-$3" &&
196 +
197 + (grep '^Cc:' msghdr1-$3 >"actual-no-cc-$3";
198 + test_cmp expected-no-cc-$3 actual-no-cc-$3)
199 +}
200 +
201 +test_suppress_self_unquoted () {
202 + test_suppress_self "$1" "$2" "unquoted-$3" <<-EOF
203 + test suppress-cc.self unquoted-$3 with name $1 email $2
204 +
205 + unquoted-$3
206 +
207 + Cc: $1 <$2>
208 + Signed-off-by: $1 <$2>
209 + EOF
210 +}
211 +
212 +test_expect_success $PREREQ 'self name is suppressed' "
213 + test_suppress_self_unquoted 'A U Thor' 'author@redhat.com' \
214 + 'self_name_suppressed'
215 +"
216 +
217 test_expect_success $PREREQ 'Show all headers' '
218 git send-email \
219 --dry-run \