Skip to content

Commit e9983f8

Browse files
committed
Merge branch 'es/chain-lint-more'
The test linter code has learned that the end of here-doc mark "EOF" can be quoted in a double-quote pair, not just in a single-quote pair. * es/chain-lint-more: chainlint: match "quoted" here-doc tags
2 parents 28d294a + 3042b6b commit e9983f8

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

t/chainlint.sed

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@
9494

9595
# here-doc -- swallow it to avoid false hits within its body (but keep the
9696
# command to which it was attached)
97-
/<<[ ]*[-\\']*[A-Za-z0-9_]/ {
98-
s/^\(.*\)<<[ ]*[-\\']*\([A-Za-z0-9_][A-Za-z0-9_]*\)'*/<\2>\1<</
97+
/<<[ ]*[-\\'"]*[A-Za-z0-9_]/ {
98+
s/^\(.*\)<<[ ]*[-\\'"]*\([A-Za-z0-9_][A-Za-z0-9_]*\)['"]*/<\2>\1<</
9999
s/[ ]*<<//
100100
:hered
101101
N
@@ -158,7 +158,7 @@ s/.*\n//
158158
}
159159
:folded
160160
# here-doc -- swallow it
161-
/<<[ ]*[-\\']*[A-Za-z0-9_]/bheredoc
161+
/<<[ ]*[-\\'"]*[A-Za-z0-9_]/bheredoc
162162
# comment or empty line -- discard since final non-comment, non-empty line
163163
# before closing ")", "done", "elsif", "else", or "fi" will need to be
164164
# re-visited to drop "suspect" marking since final line of those constructs
@@ -280,7 +280,7 @@ bfolded
280280
# found here-doc -- swallow it to avoid false hits within its body (but keep
281281
# the command to which it was attached)
282282
:heredoc
283-
s/^\(.*\)<<[ ]*[-\\']*\([A-Za-z0-9_][A-Za-z0-9_]*\)'*/<\2>\1<</
283+
s/^\(.*\)<<[ ]*[-\\'"]*\([A-Za-z0-9_][A-Za-z0-9_]*\)['"]*/<\2>\1<</
284284
s/[ ]*<<//
285285
:heredsub
286286
N

t/chainlint/here-doc.expect

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ cat >foo &&
44

55
cat >bar &&
66

7+
cat >boo &&
8+
79
horticulture

t/chainlint/here-doc.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ boz
2121
woz
2222
FUMP
2323

24+
# LINT: swallow "quoted" here-doc
25+
cat <<"zump" >boo &&
26+
snoz
27+
boz
28+
woz
29+
zump
30+
2431
# LINT: swallow here-doc (EOF is last line of test)
2532
horticulture <<\EOF
2633
gomez

t/chainlint/subshell-here-doc.expect

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
(
77
cat >bup &&
88
cat >bup2 &&
9+
cat >bup3 &&
910
meep
1011
>)

t/chainlint/subshell-here-doc.test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,9 @@
3131
glink
3232
FIZZ
3333
ARBITRARY2
34+
cat <<-"ARBITRARY3" >bup3 &&
35+
glink
36+
FIZZ
37+
ARBITRARY3
3438
meep
3539
)

0 commit comments

Comments
 (0)