mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
tests(here-doc): ensure here docs work in many situations
This commit is contained in:
parent
aeb5105d97
commit
ab861fc5c0
1 changed files with 86 additions and 0 deletions
86
test.sh
86
test.sh
|
|
@ -1473,4 +1473,90 @@ minishell: $VAR: ambiguous redirect
|
|||
minishell: $VAR: ambiguous redirect
|
||||
EOF
|
||||
|
||||
when_run <<"EOF" "here-documents limiter is not expanded"
|
||||
export LIM=hello
|
||||
cat << $LIM
|
||||
hi
|
||||
hello
|
||||
goodbye
|
||||
$LIM
|
||||
<< $LIM
|
||||
EOF
|
||||
expecting <<"EOF"
|
||||
hi
|
||||
hello
|
||||
goodbye
|
||||
minishell: warning: here-document delimited by end-of-file (wanted `$LIM')
|
||||
EOF
|
||||
|
||||
when_run <<EOF "heredoc does not execute commands"
|
||||
cat << eof > bonjour
|
||||
echo hello
|
||||
cat bonjour
|
||||
EOF
|
||||
expecting <<"EOF"
|
||||
minishell: warning: here-document delimited by end-of-file (wanted `eof')
|
||||
EOF
|
||||
|
||||
when_run <<EOF "heredoc into another file"
|
||||
cat << eof > bonjour
|
||||
hello
|
||||
there
|
||||
eof
|
||||
cat bonjour
|
||||
EOF
|
||||
expecting <<"EOF"
|
||||
hello
|
||||
there
|
||||
EOF
|
||||
|
||||
when_run <<EOF "heredoc into another command"
|
||||
cat << eof | rev
|
||||
hello
|
||||
there
|
||||
eof
|
||||
EOF
|
||||
expecting <<"EOF"
|
||||
olleh
|
||||
ereht
|
||||
EOF
|
||||
|
||||
when_run <<EOF "heredoc all alone"
|
||||
<< eof
|
||||
it's just me
|
||||
by myself
|
||||
i'm all alone ;.;
|
||||
eof
|
||||
EOF
|
||||
expecting <<"EOF"
|
||||
EOF
|
||||
|
||||
when_run <<EOF "TRIPLE SUMMON"
|
||||
cat<<x<<y<<z
|
||||
hello
|
||||
x
|
||||
there
|
||||
y
|
||||
hi
|
||||
z
|
||||
EOF
|
||||
expecting <<EOF
|
||||
hi
|
||||
EOF
|
||||
|
||||
when_run <<EOF "TRIPLE SUMMON into unknown command"
|
||||
qwertyuiop<<x<<y<<z
|
||||
hello
|
||||
x
|
||||
there
|
||||
y
|
||||
hi
|
||||
z
|
||||
echo \$?
|
||||
EOF
|
||||
expecting <<EOF
|
||||
minishell: qwertyuiop: command not found
|
||||
127
|
||||
EOF
|
||||
|
||||
finalize
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue