Skip to content

Commit 0cca54c

Browse files
sunshinecogitster
authored andcommitted
t/chainlint/one-liner: avoid overly intimate chainlint.sed knowledge
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1ad0780 commit 0cca54c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

t/chainlint/one-liner.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
?!SEMI?!(foo; bar) &&
66
?!SEMI?!(foo; bar) |
7-
?!SEMI?!(foo; bar) >baz
7+
?!SEMI?!(foo; bar) >baz &&
88

99
(foo "bar; baz")

t/chainlint/one-liner.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# LINT: top-level one-liner subshell missing internal "&&" and broken &&-chain
77
(foo; bar) &&
88
(foo; bar) |
9-
(foo; bar) >baz
9+
(foo; bar) >baz &&
1010

1111
# LINT: ";" in string not misinterpreted as broken &&-chain
1212
(foo "bar; baz")

0 commit comments

Comments
 (0)