Skip to content

Commit cc1735c

Browse files
peffgitster
authored andcommitted
t4205: refactor %(trailers) tests
We currently have one test for %(trailers). In preparation for more, let's refactor a few bits: - move the commit creation to its own setup step so it can be reused by multiple tests - add a trailer with whitespace continuation (to confirm that it is left untouched) - fix the sample text which claims the placeholder is %bT. This was switched long ago to %(trailers) - replace one "cat" with an "echo" when generating the expected output. This saves a process (and sets a better pattern for future tests to follow). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a388b10 commit cc1735c

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

t/t4205-log-pretty-formats.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -539,25 +539,29 @@ cat >trailers <<EOF
539539
Signed-off-by: A U Thor <[email protected]>
540540
Acked-by: A U Thor <[email protected]>
541541
[ v2 updated patch description ]
542-
Signed-off-by: A U Thor <[email protected]>
542+
Signed-off-by: A U Thor
543+
543544
EOF
544545

545-
test_expect_success 'pretty format %(trailers) shows trailers' '
546+
test_expect_success 'set up trailer tests' '
546547
echo "Some contents" >trailerfile &&
547548
git add trailerfile &&
548-
git commit -F - <<-EOF &&
549+
git commit -F - <<-EOF
549550
trailers: this commit message has trailers
550551
551552
This commit is a test commit with trailers at the end. We parse this
552-
message and display the trailers using %bT
553+
message and display the trailers using %(trailers).
553554
554555
$(cat trailers)
555556
EOF
556-
git log --no-walk --pretty="%(trailers)" >actual &&
557-
cat >expect <<-EOF &&
558-
$(cat trailers)
557+
'
559558

560-
EOF
559+
test_expect_success 'pretty format %(trailers) shows trailers' '
560+
git log --no-walk --pretty="%(trailers)" >actual &&
561+
{
562+
cat trailers &&
563+
echo
564+
} >expect &&
561565
test_cmp expect actual
562566
'
563567

0 commit comments

Comments
 (0)