]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t/chainlint/one-liner: avoid overly intimate chainlint.sed knowledge
authorEric Sunshine <sunshine@sunshineco.com>
Mon, 13 Dec 2021 06:30:48 +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.

Unfortunately, one of the chainlint.sed self-tests has overly intimate
knowledge of this particular division of responsibilities and only cares
about what chainlint.sed itself will produce, while ignoring the fact
that a more all-encompassing linter would complain about a broken
&&-chain outside the subshell. This makes it difficult to re-use the
test with a more capable chainlint implementation should one ever be
developed. Therefore, adjust the test and its "expected" output to
avoid being specific to the tunnel-vision of this one implementation.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/chainlint/one-liner.expect
t/chainlint/one-liner.test

index 237f22734963d62c7dafb25883530c73f730b32b..c64058f7affa7d66124c457ef3cb320242eca284 100644 (file)
@@ -4,6 +4,6 @@
 
 ?!SEMI?!(foo; bar) &&
 ?!SEMI?!(foo; bar) |
-?!SEMI?!(foo; bar) >baz
+?!SEMI?!(foo; bar) >baz &&
 
 (foo "bar; baz")
index 69796d750516016aed5d1b74b0c5f465c27ef337..be9858fa29efbe862bf07269a35abe7324568e22 100644 (file)
@@ -6,7 +6,7 @@
 # LINT: top-level one-liner subshell missing internal "&&" and broken &&-chain
 (foo; bar) &&
 (foo; bar) |
-(foo; bar) >baz
+(foo; bar) >baz &&
 
 # LINT: ";" in string not misinterpreted as broken &&-chain
 (foo "bar; baz")