Skip to content

Commit 925d730

Browse files
sunshinecogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e773545 commit 925d730

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

t/chainlint/if-then-else.expect

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
?!AMP?! echo very
55
echo empty
66
elif test -z ""
7+
then
78
echo foo
89
else
910
echo foo &&
@@ -14,6 +15,6 @@
1415
(
1516
if test -n ""; then
1617
echo very &&
17-
?!AMP?! echo empty
18-
if
18+
echo empty
19+
fi
1920
>)

t/chainlint/if-then-else.test

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# LINT: last statement before 'elif' does not need "&&"
88
echo empty
99
elif test -z ""
10+
then
1011
# LINT: last statement before 'else' does not need "&&"
1112
echo foo
1213
else
@@ -24,5 +25,5 @@
2425
if test -n ""; then
2526
echo very &&
2627
echo empty
27-
if
28+
fi
2829
)

t/chainlint/subshell-here-doc.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# LINT: missing "&&" on 'cat'
1212
cat <<EOF >bip
1313
fish fly high
14-
EOF
14+
EOF
1515

1616
# LINT: swallow here-doc (EOF is last line of subshell)
1717
echo <<-\EOF >bop

0 commit comments

Comments
 (0)