diff options
author | Eric Sunshine <sunshine@sunshineco.com> | 2022-09-01 03:29:46 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-09-01 20:07:40 +0300 |
commit | d00113ec3474a1652a73c11695c7e7b5182d80a7 (patch) | |
tree | d6f1d94812cc6ea580ef3d3beb213b1b87fc1a8b /t/chainlint/t7900-subtree.expect | |
parent | 35ebb1e37b25b9d799d1064d36a2ce668ad20264 (diff) |
t/Makefile: apply chainlint.pl to existing self-tests
Now that chainlint.pl is functional, take advantage of the existing
chainlint self-tests to validate its operation. (While at it, stop
validating chainlint.sed against the self-tests since it will soon be
retired.)
Due to chainlint.sed implementation limitations leaking into the
self-test "expect" files, a few of them require minor adjustment to make
them compatible with chainlint.pl which does not share those
limitations.
First, because `sed` does not provide any sort of real recursion,
chainlint.sed only emulates recursion into subshells, and each level of
recursion leads to a multiplicative increase in complexity of the `sed`
rules. To avoid substantial complexity, chainlint.sed, therefore, only
emulates subshell recursion one level deep. Any subshell deeper than
that is passed through as-is, which means that &&-chains are not checked
in deeper subshells. chainlint.pl, on the other hand, employs a proper
recursive descent parser, thus checks subshells to any depth and
correctly flags broken &&-chains in deep subshells.
Second, due to sed's line-oriented nature, chainlint.sed, by necessity,
folds multi-line quoted strings into a single line. chainlint.pl, on the
other hand, employs a proper lexical analyzer which preserves quoted
strings as-is, including embedded newlines.
Furthermore, the output of chainlint.sed and chainlint.pl do not match
precisely in terms of whitespace. However, since the purpose of the
self-checks is to verify that the ?!AMP?! annotations are being
correctly added, minor whitespace differences are immaterial. For this
reason, rather than adjusting whitespace in all existing self-test
"expect" files to match the new linter's output, the `check-chainlint`
target ignores whitespace differences. Since `diff -w` is not POSIX,
`check-chainlint` attempts to employ `git diff -w`, and only falls back
to non-POSIX `diff -w` (and `-u`) if `git diff` is not available.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/chainlint/t7900-subtree.expect')
-rw-r--r-- | t/chainlint/t7900-subtree.expect | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/t/chainlint/t7900-subtree.expect b/t/chainlint/t7900-subtree.expect index 1cccc7bf7e..69167da2f2 100644 --- a/t/chainlint/t7900-subtree.expect +++ b/t/chainlint/t7900-subtree.expect @@ -1,10 +1,17 @@ ( - chks="sub1sub2sub3sub4" && + chks="sub1 +sub2 +sub3 +sub4" && chks_sub=$(cat <<TXT | sed "s,^,sub dir/," ) && - chkms="main-sub1main-sub2main-sub3main-sub4" && + chkms="main-sub1 +main-sub2 +main-sub3 +main-sub4" && chkms_sub=$(cat <<TXT | sed "s,^,sub dir/," ) && subfiles=$(git ls-files) && - check_equal "$subfiles" "$chkms$chks" + check_equal "$subfiles" "$chkms +$chks" ) |