t1901: use tr in git repo structure output instead of expected value

The test 'keyvalue and nul format', as it description says, test both
keyvalue and nul format. These formats are similar, differing only in
their field separator (= in the former, LF in the latter) and their
record separator (LF in the former, NUL in the latter). This way, both
formats can be tested using the same expected output and only replacing
the separators in one of the output formats.

Adjust the output of `git repo structure --format=nul` in t1901, matching the
--format=keyvalue ones. Compare this output against the same value expected
from --format=keyvalue.

Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Lucas Seiki Oshiro
2026-02-18 18:08:42 -03:00
committed by Junio C Hamano
parent 3726d56030
commit 55a3aa1c25

View File

@@ -145,18 +145,18 @@ test_expect_success SHA1 'lines and nul format' '
test_cmp expect out &&
test_line_count = 0 err &&
# Replace key and value delimiters for nul format.
tr "\n=" "\0\n" <expect >expect_nul &&
git repo structure --format=nul >out 2>err &&
tr "\012" "=" <out | tr "\000" "\012" >actual &&
test_cmp expect_nul out &&
test_cmp expect actual &&
test_line_count = 0 err &&
# "-z", as a synonym to "--format=nul", participates in the
# usual "last one wins" rule.
git repo structure --format=table -z >out 2>err &&
tr "\012" "=" <out | tr "\000" "\012" >actual &&
test_cmp expect_nul out &&
test_cmp expect actual &&
test_line_count = 0 err
)
'