Skip to content

Commit 5adcf2c

Browse files
mstsirkingitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b1d04bf commit 5adcf2c

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

t/t9001-send-email.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,49 @@ Result: OK
171171
EOF
172172
"
173173

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+
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' '[email protected]' \
214+
'self_name_suppressed'
215+
"
216+
174217
test_expect_success $PREREQ 'Show all headers' '
175218
git send-email \
176219
--dry-run \

0 commit comments

Comments
 (0)