зеркало из https://github.com/microsoft/git.git
t/chainlint/*.test: generalize self-test commentary
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>
This commit is contained in:
Родитель
5459bc1bbb
Коммит
1ad0780a77
|
@ -3,7 +3,7 @@
|
||||||
nothing &&
|
nothing &&
|
||||||
|
|
||||||
something
|
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)
|
# LINT: significant to "&&"-check, not final _line_ (which might be blank)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
(
|
(
|
||||||
# LINT: missing "&&" in block not currently detected (for consistency with
|
# LINT: missing "&&" after first "echo"
|
||||||
# LINT: --chain-lint at top level and to provide escape hatch if needed)
|
|
||||||
foo &&
|
foo &&
|
||||||
{
|
{
|
||||||
echo a
|
echo a
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
# LINT: first subshell statement cuddled with opening "("; for implementation
|
# LINT: first subshell statement cuddled with opening "("
|
||||||
# LINT: simplicity, "(..." is split into two lines, "(" and "..."
|
|
||||||
(cd foo &&
|
(cd foo &&
|
||||||
bar
|
bar
|
||||||
) &&
|
) &&
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
cd foo &&
|
cd foo &&
|
||||||
(
|
(
|
||||||
# LINT: nested multi-line subshell not presently checked for missing "&&"
|
|
||||||
echo a
|
echo a
|
||||||
echo b
|
echo b
|
||||||
) >file
|
) >file
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
(foo && bar) |
|
(foo && bar) |
|
||||||
(foo && bar) >baz &&
|
(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) |
|
(foo; bar) |
|
||||||
(foo; bar) >baz
|
(foo; bar) >baz
|
||||||
|
|
|
@ -15,11 +15,11 @@
|
||||||
cat foo; echo bar
|
cat foo; echo bar
|
||||||
) &&
|
) &&
|
||||||
(
|
(
|
||||||
# LINT: unnecessary terminating semicolon
|
# LINT: semicolon unnecessary but legitimate
|
||||||
foo;
|
foo;
|
||||||
) &&
|
) &&
|
||||||
(cd foo &&
|
(cd foo &&
|
||||||
for i in a b c; do
|
for i in a b c; do
|
||||||
# LINT: unnecessary terminating semicolon
|
# LINT: semicolon unnecessary but legitimate
|
||||||
echo;
|
echo;
|
||||||
done)
|
done)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче