diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-05-14 14:18:50 +0300 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-05-27 08:35:29 +0200 |
commit | e1c923e1c5cc07d21669cc2452b780a321df1bec (patch) | |
tree | b8cba07249c7d74b388554afd51d429b24c2a1db /libbuild2/build/script/parser+here-document.test.testscript | |
parent | d85461c4280e292994412056216daf5f82fdd6e9 (diff) |
Add build script
Diffstat (limited to 'libbuild2/build/script/parser+here-document.test.testscript')
-rw-r--r-- | libbuild2/build/script/parser+here-document.test.testscript | 212 |
1 files changed, 212 insertions, 0 deletions
diff --git a/libbuild2/build/script/parser+here-document.test.testscript b/libbuild2/build/script/parser+here-document.test.testscript new file mode 100644 index 0000000..8ea6373 --- /dev/null +++ b/libbuild2/build/script/parser+here-document.test.testscript @@ -0,0 +1,212 @@ +# file : libbuild2/build/script/parser+here-document.test.testscript +# license : MIT; see accompanying LICENSE file + +: end-marker +: +{ + : missing-newline + : + $* <'cmd <<' 2>>EOE != 0 + buildfile:11:7: error: expected here-document end marker + EOE + + : missing-exit + : + $* <'cmd << != 0' 2>>EOE != 0 + buildfile:11:8: error: expected here-document end marker + EOE + + : missing-empty + : + $* <'cmd <<""' 2>>EOE != 0 + buildfile:11:7: error: expected here-document end marker + EOE + + : unseparated-expansion + : + $* <'cmd <<FOO$foo' 2>>EOE != 0 + buildfile:11:10: error: here-document end marker must be literal + EOE + + : quoted-single-partial + : + $* <"cmd <<F'O'O" 2>>EOE != 0 + buildfile:11:7: error: partially-quoted here-document end marker + EOE + + : quoted-double-partial + : + $* <'cmd <<"FO"O' 2>>EOE != 0 + buildfile:11:7: error: partially-quoted here-document end marker + EOE + + : quoted-mixed + : + $* <"cmd <<\"FO\"'O'" 2>>EOE != 0 + buildfile:11:7: error: partially-quoted here-document end marker + EOE + + : unseparated + : + $* <<EOI >>EOO + cmd <<EOF!=0 + foo + EOF + EOI + cmd <<EOF != 0 + foo + EOF + EOO + + : quoted-single + : + $* <<EOI >>EOO + cmd <<'EOF' + foo + EOF + EOI + cmd <<EOF + foo + EOF + EOO + + : quoted-double + : + $* <<EOI >>EOO + cmd <<"EOF" + foo + EOF + EOI + cmd <<EOF + foo + EOF + EOO +} + +: indent +: +{ + : basic + : + $* <<EOI >>EOO + cmd <<EOF + foo + bar + baz + EOF + EOI + cmd <<EOF + foo + bar + baz + EOF + EOO + + : blank + : + $* <<EOI >>EOO + cmd <<EOF + foo + + + bar + EOF + EOI + cmd <<EOF + foo + + + bar + EOF + EOO + + : non-ws-prefix + : + $* <<EOI >>EOO + cmd <<EOF + x EOF + EOF + EOI + cmd <<EOF + x EOF + EOF + EOO + + : whole-token + : Test the case where the indentation is a whole token + : + $* <<EOI >>EOO + x = foo bar + cmd <<"EOF" + $x + EOF + EOI + cmd <<EOF + foo bar + EOF + EOO + + : long-line + : Test the case where the line contains multiple tokens + : + $* <<EOI >>EOO + x = foo + cmd <<"EOF" + $x bar $x + EOF + EOI + cmd <<EOF + foo bar foo + EOF + EOO + + : unindented + : + $* <<EOI 2>>EOE != 0 + cmd <<EOF + bar + EOF + EOI + buildfile:12:1: error: unindented here-document line + EOE +} + +: blank +: +$* <<EOI >>EOO +cmd <<EOF + +foo + +bar + +EOF +EOI +cmd <<EOF + +foo + +bar + +EOF +EOO + +: quote +: +: Note: they are still recognized in eval contexts. +: +$* <<EOI >>EOO +cmd <<"EOF" +'single' +"double" +b'o't"h" +('single' "double") +EOF +EOI +cmd <<EOF +'single' +"double" +b'o't"h" +single double +EOF +EOO |