Skip to content

Commit ec3b4b0

Browse files
Christian Ludwiggitster
authored andcommitted
t9001: use existing helper in send-email test
Use the wrapper function around the sed statement like everywhere else in the test. Unfortunately the wrapper function is defined pretty late. Move the wrapper to the top of the test file, so future users have it available right away. Signed-off-by: Christian Ludwig <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 27dea46 commit ec3b4b0

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

t/t9001-send-email.sh

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ test_description='git send-email'
66
# May be altered later in the test
77
PREREQ="PERL"
88

9+
replace_variable_fields () {
10+
sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \
11+
-e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
12+
-e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/"
13+
}
14+
915
test_expect_success $PREREQ 'prepare reference tree' '
1016
echo "1A quick brown fox jumps over the" >file &&
1117
echo "lazy dog" >>file &&
@@ -293,10 +299,7 @@ test_expect_success $PREREQ 'Show all headers' '
293299
294300
--in-reply-to="<[email protected]>" \
295301
--smtp-server relay.example.com \
296-
$patches |
297-
sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \
298-
-e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
299-
-e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \
302+
$patches | replace_variable_fields \
300303
>actual-show-all-headers &&
301304
test_cmp expected-show-all-headers actual-show-all-headers
302305
'
@@ -551,12 +554,6 @@ Result: OK
551554
EOF
552555
"
553556

554-
replace_variable_fields () {
555-
sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \
556-
-e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
557-
-e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/"
558-
}
559-
560557
test_suppression () {
561558
git send-email \
562559
--dry-run \

0 commit comments

Comments
 (0)