Skip to content

Commit dd6003f

Browse files
pks-tttaylorr
authored andcommitted
t6006: fix prereq handling with test_format ()
In df383b5 (t/test-lib: wire up NO_ICONV prerequisite, 2024-10-16) we have introduced a new NO_ICONV prerequisite that makes us skip tests in case Git is not compiled with support for iconv. This change subtly broke t6006: while the test suite still passes, some of its tests won't execute because they run into an error. ./t6006-rev-list-format.sh: line 92: test_expect_%e: command not found The broken tests use `test_format ()`, and the mentioned commit simply prepended the new prerequisite to its arguments. But that does not work, as the function is not aware of prereqs at all and will now treat all of its arguments incorrectly. Fix this by making the function aware of prereqs by accepting an optional fourth argument. Adapt the callsites accordingly. Reported-by: Josh Steadmon <[email protected]> Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Taylor Blau <[email protected]>
1 parent 80ebd91 commit dd6003f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

t/t6006-rev-list-format.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ test_expect_success 'setup' '
7575
git config --unset i18n.commitEncoding
7676
'
7777

78-
# usage: test_format [argument...] name format_string [failure] <expected_output
78+
# usage: test_format [argument...] name format_string [success|failure] [prereq] <expected_output
7979
test_format () {
8080
local args=
8181
while true
@@ -89,7 +89,7 @@ test_format () {
8989
esac
9090
done
9191
cat >expect.$1
92-
test_expect_${3:-success} "format $1" "
92+
test_expect_${3:-success} $4 "format $1" "
9393
git rev-list $args --pretty=format:'$2' main >output.$1 &&
9494
test_cmp expect.$1 output.$1
9595
"
@@ -218,7 +218,7 @@ Thu, 7 Apr 2005 15:13:13 -0700
218218
1112911993
219219
EOF
220220

221-
test_format ICONV encoding %e <<EOF
221+
test_format encoding %e success ICONV <<EOF
222222
commit $head2
223223
$test_encoding
224224
commit $head1
@@ -394,7 +394,7 @@ test_expect_success 'setup complex body' '
394394
head3_short=$(git rev-parse --short $head3)
395395
'
396396

397-
test_format ICONV complex-encoding %e <<EOF
397+
test_format complex-encoding %e success ICONV <<EOF
398398
commit $head3
399399
$test_encoding
400400
commit $head2

0 commit comments

Comments
 (0)