fix: normalize heredoc line continuations

This commit is contained in:
dajiaohuang
2026-08-29 14:55:14 -04:00
committed by haelyra
parent 9768c075c3
commit c40d0e4f7c
2 changed files with 73 additions and 9 deletions
+33
View File
@@ -1760,6 +1760,39 @@ function runTests() {
passed++;
else failed++;
if (
test('denies split command names after heredoc line continuation', () => {
expectDestructiveDeny(
['cat <<EOF', '$(r\\', 'm -rf /tmp/expanded-target', ')', 'EOF'].join('\n'),
'split command name in unquoted heredoc substitution'
);
})
)
passed++;
else failed++;
if (
test('denies split options after tab-stripped heredoc line continuation', () => {
expectDestructiveDeny(
['cat <<-EOF', '\t$(rm\\', '\t-rf /tmp/expanded-target)', 'EOF'].join('\n'),
'split option in tab-stripped unquoted heredoc substitution'
);
})
)
passed++;
else failed++;
if (
test('preserves internal tabs after tab-stripped heredoc continuations', () => {
expectAllow(
['cat <<-EOF', '\t$(r\\', '\tm -rf /tmp/expanded-target)', 'EOF'].join('\n'),
'internal tab after tab-stripped heredoc continuation'
);
})
)
passed++;
else failed++;
if (
test('fails closed on line-continued unquoted heredoc terminators', () => {
expectDestructiveDeny(