t/chainlint/*.test: don't use invalid shell syntax
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>
Eric Sunshine committed
Dec 13, 2021 at 01:30 UTC
925d7304d2a5f5dda9fbe3f541338bb87083f6b2
3 files changed
+6
-4
t/chainlint/if-then-else.expect
+3
-2
@@ -4,6 +4,7 @@
4
?!AMP?! echo very
5
echo empty
6
elif test -z ""
7
+ then
8
echo foo
9
else
10
echo foo &&
@@ -14,6 +15,6 @@
15
(
16
if test -n ""; then
17
echo very &&
17
-?!AMP?! echo empty
18
- if
18
+ echo empty
19
+ fi
20
>)
t/chainlint/if-then-else.test
+2
-1
@@ -7,6 +7,7 @@
7
# LINT: last statement before 'elif' does not need "&&"
8
echo empty
9
elif test -z ""
10
+ then
11
# LINT: last statement before 'else' does not need "&&"
12
echo foo
13
else
@@ -24,5 +25,5 @@
25
if test -n ""; then
26
echo very &&
27
echo empty
27
- if
28
+ fi
29
)
t/chainlint/subshell-here-doc.test
+1
-1
@@ -11,7 +11,7 @@
11
# LINT: missing "&&" on 'cat'
12
cat <<EOF >bip
13
fish fly high
14
- EOF
14
+EOF
15
16
# LINT: swallow here-doc (EOF is last line of subshell)
17
echo <<-\EOF >bop