aboutsummaryrefslogtreecommitdiff
path: root/unit-tests
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-11-25 15:17:01 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-11-25 15:17:01 +0200
commit757f42e7dea94f8b79b3d55074dedeafd853ddc5 (patch)
tree8fa27fd27e36a85a6348d85b746d49a676a27027 /unit-tests
parenta3dad2118fb3925ef4f9baa90cea0dfd44ca93c6 (diff)
Implement literal here-document support
Diffstat (limited to 'unit-tests')
-rw-r--r--unit-tests/function/call.test42
-rw-r--r--unit-tests/function/syntax.test6
-rw-r--r--unit-tests/lexer/comment.test24
-rw-r--r--unit-tests/lexer/quoting.test4
-rw-r--r--unit-tests/test/script/lexer/driver.cxx3
-rw-r--r--unit-tests/test/script/parser/command-if.test2
-rw-r--r--unit-tests/test/script/parser/command-re-parse.test4
-rw-r--r--unit-tests/test/script/parser/description.test4
-rw-r--r--unit-tests/test/script/parser/expansion.test2
-rw-r--r--unit-tests/test/script/parser/here-document.test10
-rw-r--r--unit-tests/test/script/parser/include.test4
-rw-r--r--unit-tests/test/script/parser/scope.test10
12 files changed, 58 insertions, 57 deletions
diff --git a/unit-tests/function/call.test b/unit-tests/function/call.test
index 396090a..d16b91c 100644
--- a/unit-tests/function/call.test
+++ b/unit-tests/function/call.test
@@ -13,8 +13,8 @@ $* <'print $dummy.qual()' >'abc'
: qual-fail
:
$* <'print $qual()' 2>>EOE != 0
-buildfile:1:8: error: unmatched call to qual\()
- info: candidate: dummy.qual\()
+buildfile:1:8: error: unmatched call to qual()
+ info: candidate: dummy.qual()
EOE
: derived-base
@@ -32,42 +32,42 @@ $* <'print $variadic([bool] true)' >'1'
:
$* <'$fail()' 2>>EOE != 0
error: failed
-buildfile:1:2: info: while calling fail\()
+buildfile:1:2: info: while calling fail()
EOE
: fail-invalid-arg
:
$* <'$fail_arg(abc)' 2>>EOE != 0
error: invalid argument: invalid uint64 value: 'abc'
-buildfile:1:2: info: while calling fail_arg\(<untyped>)
+buildfile:1:2: info: while calling fail_arg(<untyped>)
EOE
: no-match-name
:
$* <'$bogus()' 2>>EOE != 0
-buildfile:1:2: error: unmatched call to bogus\()
+buildfile:1:2: error: unmatched call to bogus()
EOE
: no-match-count
:
$* <'$dummy0(abc)' 2>>EOE != 0
-buildfile:1:2: error: unmatched call to dummy0\(<untyped>)
- info: candidate: dummy0\(), qualified name dummy.dummy0
+buildfile:1:2: error: unmatched call to dummy0(<untyped>)
+ info: candidate: dummy0(), qualified name dummy.dummy0
EOE
: no-match-type
:
$* <'$dummy1([uint64] 123)' 2>>EOE != 0
-buildfile:1:2: error: unmatched call to dummy1\(uint64)
- info: candidate: dummy1\(string), qualified name dummy.dummy1
+buildfile:1:2: error: unmatched call to dummy1(uint64)
+ info: candidate: dummy1(string), qualified name dummy.dummy1
EOE
: ambig
:
$* <'$ambig(abc)' 2>- != 0 # @@ REGEX
-#buildfile:1:2: error: ambiguous call to ambig\(<untyped>)
-# info: candidate: ambig\(<untyped> [, uint64]), qualified name dummy.ambig
-# info: candidate: ambig\(<untyped> [, string]), qualified name dummy.ambig
+#buildfile:1:2: error: ambiguous call to ambig(<untyped>)
+# info: candidate: ambig(<untyped> [, uint64]), qualified name dummy.ambig
+# info: candidate: ambig(<untyped> [, string]), qualified name dummy.ambig
#EOE
: optional-absent
@@ -90,19 +90,19 @@ $* <'print $nullable(nonull)' >'false'
:
$* <'$dummy1([string null])' 2>>EOE != 0
error: invalid argument: null value
-buildfile:1:2: info: while calling dummy1\(string)
+buildfile:1:2: info: while calling dummy1(string)
EOE
: print-call-1-untyped
:
$* <'$bogus(abc)' 2>>EOE != 0
-buildfile:1:2: error: unmatched call to bogus\(<untyped>)
+buildfile:1:2: error: unmatched call to bogus(<untyped>)
EOE
: print-call-1-typed
:
$* <'$bogus([uint64] 123)' 2>>EOE != 0
-buildfile:1:2: error: unmatched call to bogus\(uint64)
+buildfile:1:2: error: unmatched call to bogus(uint64)
EOE
#\
@@ -110,23 +110,23 @@ EOE
: print-call-2
:
$* <'$bogus(abc, [uint64] 123)' 2>>EOE != 0
-buildfile:1:2: error: unmatched call to bogus\(<untyped>, uint64)
+buildfile:1:2: error: unmatched call to bogus(<untyped>, uint64)
EOE
#\
: print-fovl
:
$* <'$ambig([bool] true)' 2>- != 0 # @@ REGEX
-#buildfile:1:2: error: unmatched call to ambig\(bool)
-# info: candidate: ambig\(<untyped> [, uint64]), qualified name dummy.ambig
-# info: candidate: ambig\(<untyped> [, string]), qualified name dummy.ambig
+#buildfile:1:2: error: unmatched call to ambig(bool)
+# info: candidate: ambig(<untyped> [, uint64]), qualified name dummy.ambig
+# info: candidate: ambig(<untyped> [, string]), qualified name dummy.ambig
#EOE
: print-fovl-variadic
:
$* <'$variadic(abc)' 2>>EOE != 0
-buildfile:1:2: error: unmatched call to variadic\(<untyped>)
- info: candidate: variadic\(bool [, ...])
+buildfile:1:2: error: unmatched call to variadic(<untyped>)
+ info: candidate: variadic(bool [, ...])
EOE
: member-function
diff --git a/unit-tests/function/syntax.test b/unit-tests/function/syntax.test
index 9e653c8..d644fd1 100644
--- a/unit-tests/function/syntax.test
+++ b/unit-tests/function/syntax.test
@@ -19,9 +19,9 @@ $* <<EOI >>EOO
foo = FOO
bar = BAR
-print \$foo"\(\$bar)"
-print "\$foo"\(\$bar)
-print "\$foo""\(\$bar)"
+print $foo"($bar)"
+print "$foo"($bar)
+print "$foo""($bar)"
EOI
FOOBAR
FOOBAR
diff --git a/unit-tests/lexer/comment.test b/unit-tests/lexer/comment.test
index 07d7ac5..65e768c 100644
--- a/unit-tests/lexer/comment.test
+++ b/unit-tests/lexer/comment.test
@@ -59,34 +59,34 @@ EOO
#
$* <<EOI >>:EOO # multi-only
-#\\
+#\
comment
comment
-#\\
+#\
EOI
EOO
$* <<EOI >>:EOO # multi-empty
-#\\
-#\\
+#\
+#\
EOI
EOO
$* <<EOI >>EOO # multi-start-same
-foo #\\
+foo #\
comment
comment
-#\\
+#\
EOI
'foo'
<newline>
EOO
$* <<EOI >>EOO # multi-end-same
-#\\
+#\
comment
comment
-foo #\\
+foo #\
bar
EOI
'bar'
@@ -94,10 +94,10 @@ EOI
EOO
$* <<EOI >>EOO # multi-end-not
-#\\
+#\
comment
-#\\ not an end
-foo #\\
+#\ not an end
+foo #\
bar
EOI
'bar'
@@ -105,7 +105,7 @@ EOI
EOO
$* <<EOI 2>>EOE != 0 # multi-unterm
-#\\
+#\
comment
EOI
stdin:3:1: error: unterminated multi-line comment
diff --git a/unit-tests/lexer/quoting.test b/unit-tests/lexer/quoting.test
index 76fd904..aab02c3 100644
--- a/unit-tests/lexer/quoting.test
+++ b/unit-tests/lexer/quoting.test
@@ -48,7 +48,7 @@ EOO
:
$* <'"$foo"' >>EOO
'' [D/P]
-\$
+$
'foo' [D/P]
<newline>
EOO
@@ -58,7 +58,7 @@ EOO
:
$* <'"foo$"' >>EOO
'foo' [D/P]
-\$
+$
'' [D/P]
<newline>
EOO
diff --git a/unit-tests/test/script/lexer/driver.cxx b/unit-tests/test/script/lexer/driver.cxx
index abd32ba..3709191 100644
--- a/unit-tests/test/script/lexer/driver.cxx
+++ b/unit-tests/test/script/lexer/driver.cxx
@@ -34,7 +34,8 @@ namespace build2
else if (s == "second-token") m = lexer_mode::second_token;
else if (s == "variable-line") m = lexer_mode::variable_line;
else if (s == "command-line") m = lexer_mode::command_line;
- else if (s == "here-line") m = lexer_mode::here_line;
+ else if (s == "here-line-single") m = lexer_mode::here_line_single;
+ else if (s == "here-line-double") m = lexer_mode::here_line_double;
else if (s == "description-line") m = lexer_mode::description_line;
else if (s == "variable") m = lexer_mode::variable;
else assert (false);
diff --git a/unit-tests/test/script/parser/command-if.test b/unit-tests/test/script/parser/command-if.test
index 88cc7d6..4bbc016 100644
--- a/unit-tests/test/script/parser/command-if.test
+++ b/unit-tests/test/script/parser/command-if.test
@@ -249,7 +249,7 @@ if true
else
x = bar
end;
-cmd \$x
+cmd $x
EOI
? true
cmd foo
diff --git a/unit-tests/test/script/parser/command-re-parse.test b/unit-tests/test/script/parser/command-re-parse.test
index aee4f78..335ff69 100644
--- a/unit-tests/test/script/parser/command-re-parse.test
+++ b/unit-tests/test/script/parser/command-re-parse.test
@@ -2,8 +2,8 @@
# double-quote
#
$* <<EOI >>EOO
-x = cmd \\">-\\" "'<-'"
-\$x
+x = cmd \">-\" "'<-'"
+$x
EOI
cmd '>-' '<-'
EOO
diff --git a/unit-tests/test/script/parser/description.test b/unit-tests/test/script/parser/description.test
index 1b3f358..b4ab435 100644
--- a/unit-tests/test/script/parser/description.test
+++ b/unit-tests/test/script/parser/description.test
@@ -180,7 +180,7 @@ EOE
$* <<EOI >>EOO # legal-var
: foo bar
x = y;
-cmd \$x
+cmd $x
EOI
: sm:foo bar
cmd y
@@ -334,7 +334,7 @@ EOO
:
: No merge since test has description.
:
-$* -s -i <<EOI >>EOO #
+$* -s -i <<EOI >>EOO #
{
: foo-bar
: foo bar
diff --git a/unit-tests/test/script/parser/expansion.test b/unit-tests/test/script/parser/expansion.test
index c23d598..1d10a63 100644
--- a/unit-tests/test/script/parser/expansion.test
+++ b/unit-tests/test/script/parser/expansion.test
@@ -6,7 +6,7 @@
$* <<EOI >>EOO
x = dir/ proj% proj%name proj%proj%dir/type{name name {name}}
cmd dir/ proj% proj%name proj%proj%dir/type{name name {name}}
-cmd \$x
+cmd $x
EOI
cmd dir/ proj% proj%name proj%proj%dir/type{name name {name}}
cmd dir/ proj% proj%name proj%proj%dir/type{name name {name}}
diff --git a/unit-tests/test/script/parser/here-document.test b/unit-tests/test/script/parser/here-document.test
index 6f26166..7cb9474 100644
--- a/unit-tests/test/script/parser/here-document.test
+++ b/unit-tests/test/script/parser/here-document.test
@@ -128,8 +128,8 @@
:
$* <<EOI >>EOO
x = foo bar
- cmd <<EOF
- \$x
+ cmd <<"EOF"
+ $x
EOF
EOI
cmd <<EOF
@@ -142,8 +142,8 @@
:
$* <<EOI >>EOO
x = foo
- cmd <<EOF
- \$x bar \$x
+ cmd <<"EOF"
+ $x bar $x
EOF
EOI
cmd <<EOF
@@ -185,7 +185,7 @@ EOO
: Note: they are still recognized in eval contexts.
:
$* <<EOI >>EOO
-cmd <<EOF
+cmd <<"EOF"
'single'
"double"
b'o't"h"
diff --git a/unit-tests/test/script/parser/include.test b/unit-tests/test/script/parser/include.test
index 65ce7ce..7a3b517 100644
--- a/unit-tests/test/script/parser/include.test
+++ b/unit-tests/test/script/parser/include.test
@@ -14,7 +14,7 @@ EOO
touch foo.test;
$* <<EOI
x = foo.test
-.include\$x
+.include$x
EOI
: none
@@ -108,7 +108,7 @@ cat <<EOI >>>foo-$(build.version).test;
cmd
EOI
$* <<EOI >>EOO
-.include foo-\$\(build.version\).test
+.include foo-$(build.version).test
EOI
cmd
EOO
diff --git a/unit-tests/test/script/parser/scope.test b/unit-tests/test/script/parser/scope.test
index 3b10d01..6ddb265 100644
--- a/unit-tests/test/script/parser/scope.test
+++ b/unit-tests/test/script/parser/scope.test
@@ -74,7 +74,7 @@ EOO
$* -s -i <<EOI >>EOO # test-scope-var
{
x = abc
- cmd \$x
+ cmd $x
}
EOI
{
@@ -88,7 +88,7 @@ $* -s -i <<EOI >>EOO # test-scope-setup
{
x = abc
+setup
- cmd \$x
+ cmd $x
}
EOI
{
@@ -166,7 +166,7 @@ EOO
$* -s <<EOI >>EOO # test-var
cmd1;
x = abc;
-cmd2 \$x
+cmd2 $x
EOI
{
{
@@ -178,7 +178,7 @@ EOO
$* -s <<EOI >>EOO # test-var-first
x = abc;
-cmd \$x
+cmd $x
EOI
{
{
@@ -189,7 +189,7 @@ EOO
$* -s <<EOI >>EOO # var-setup-tdown
x = abc
-cmd \$x
+cmd $x
y = 123
EOI
{