]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t/chainlint/*.test: generalize self-test commentary
authorEric Sunshine <sunshine@sunshineco.com>
Mon, 13 Dec 2021 06:30:47 +0000 (01:30 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 13 Dec 2021 22:15:28 +0000 (14:15 -0800)
The purpose of chainlint.sed is to detect &&-chain breakage only within
subshells (one level deep); it doesn't bother checking for top-level
&&-chain breakage since the &&-chain checker built into t/test-lib.sh
should detect broken &&-chains outside of subshells by making them
magically exit with code 117. However, this division of labor may not
always be the case if a more capable chainlint implementation is ever
developed. Beyond that, due to being sed-based and due to its use of
heuristics, chainlint.sed has several limitations (such as being unable
to detect &&-chain breakage in subshells more than one level deep since
it only manually emulates recursion into a subshell).

Some of the comments in the chainlint self-tests unnecessarily reflect
the limitations of chainlint.sed even though those limitations are not
what is being tested. Therefore, simplify and generalize the comments to
explain only what is being tested, thus ensuring that they won't become
outdated if a more capable chainlint is ever developed.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/chainlint/blank-line.test
t/chainlint/block.test
t/chainlint/cuddled.test
t/chainlint/nested-subshell.test
t/chainlint/one-liner.test
t/chainlint/semicolon.test

index f6dd14302b2bed89e65634d9d57b0a97dbf7ead5..0fdf15b3e14c6aaac3bbbc8f2c4f04035845cd4c 100644 (file)
@@ -3,7 +3,7 @@
        nothing &&
 
        something
-# LINT: swallow blank lines since final _statement_ before subshell end is
+# LINT: ignore blank lines since final _statement_ before subshell end is
 # LINT: significant to "&&"-check, not final _line_ (which might be blank)
 
 
index d859151af1d9ac89709a3c972b75dbdc8cd53321..0a82fd579f6751a8ed7a88505d2c7988eaf3ae5c 100644 (file)
@@ -1,6 +1,5 @@
 (
-# LINT: missing "&&" in block not currently detected (for consistency with
-# LINT: --chain-lint at top level and to provide escape hatch if needed)
+# LINT: missing "&&" after first "echo"
        foo &&
        {
                echo a
index 0499fa4180596cc4f8c054a7e2a8a640bdb679ce..257b5b5eed3a23a6549f3a6f2b5ea77a776ad7e9 100644 (file)
@@ -1,5 +1,4 @@
-# LINT: first subshell statement cuddled with opening "("; for implementation
-# LINT: simplicity, "(..." is split into two lines, "(" and "..."
+# LINT: first subshell statement cuddled with opening "("
 (cd foo &&
        bar
 ) &&
index 998b05a47d300570faf8ff16b584517677a21567..440ee9992da3491a85fae254bdb7eb14176d4a29 100644 (file)
@@ -7,7 +7,6 @@
 
        cd foo &&
        (
-# LINT: nested multi-line subshell not presently checked for missing "&&"
                echo a
                echo b
        ) >file
index ec9acb98253de1e3c3f94c9843142b45745088b1..69796d750516016aed5d1b74b0c5f465c27ef337 100644 (file)
@@ -3,7 +3,7 @@
 (foo && bar) |
 (foo && bar) >baz &&
 
-# LINT: top-level one-liner subshell missing internal "&&"
+# LINT: top-level one-liner subshell missing internal "&&" and broken &&-chain
 (foo; bar) &&
 (foo; bar) |
 (foo; bar) >baz
index d82c8ebbc00680cf3fc3753d07791865630962ba..67e1192c50ab0c47a74152a4fd59a6d70797b717 100644 (file)
        cat foo; echo bar
 ) &&
 (
-# LINT: unnecessary terminating semicolon
+# LINT: semicolon unnecessary but legitimate
        foo;
 ) &&
 (cd foo &&
        for i in a b c; do
-# LINT: unnecessary terminating semicolon
+# LINT: semicolon unnecessary but legitimate
                echo;
        done)