From ab861fc5c047177531e3667c21f92a6b39852105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kha=C3=AFs=20COLIN?= Date: Mon, 28 Apr 2025 16:35:22 +0200 Subject: [PATCH] tests(here-doc): ensure here docs work in many situations --- test.sh | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/test.sh b/test.sh index 70bf468..7a12d78 100755 --- a/test.sh +++ b/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 < bonjour +echo hello +cat bonjour +EOF +expecting <<"EOF" +minishell: warning: here-document delimited by end-of-file (wanted `eof') +EOF + +when_run < bonjour +hello +there +eof +cat bonjour +EOF +expecting <<"EOF" +hello +there +EOF + +when_run <