925d7304d2
The chainlint self-test code snippets are supposed to represent the body of a test_expect_success() or test_expect_failure(), yet the contents of these tests would have caused the shell to report syntax errors had they been real test bodies. Although chainlint.sed, with its simplistic heuristics, is blind to these syntactic problems, a future more robust chainlint implementation might not have such a limitation, so make these snippets syntactically valid. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
30 lines
529 B
Plaintext
30 lines
529 B
Plaintext
(
|
|
# LINT: 'if', 'then', 'elif', 'else', 'fi' do not need "&&"
|
|
if test -n ""
|
|
then
|
|
# LINT: missing "&&" on 'echo'
|
|
echo very
|
|
# LINT: last statement before 'elif' does not need "&&"
|
|
echo empty
|
|
elif test -z ""
|
|
then
|
|
# LINT: last statement before 'else' does not need "&&"
|
|
echo foo
|
|
else
|
|
echo foo &&
|
|
# LINT: last statement before 'fi' does not need "&&"
|
|
cat <<-\EOF
|
|
bar
|
|
EOF
|
|
# LINT: missing "&&" on 'fi'
|
|
fi
|
|
echo poodle
|
|
) &&
|
|
(
|
|
# LINT: 'then' on same line as 'if'
|
|
if test -n ""; then
|
|
echo very &&
|
|
echo empty
|
|
fi
|
|
)
|