aboutsummaryrefslogtreecommitdiff
path: root/unit-tests/test
diff options
context:
space:
mode:
Diffstat (limited to 'unit-tests/test')
-rw-r--r--unit-tests/test/script/lexer/buildfile2
-rw-r--r--unit-tests/test/script/lexer/driver.cxx6
-rw-r--r--unit-tests/test/script/lexer/first-token.test (renamed from unit-tests/test/script/lexer/assign-line.test)2
-rw-r--r--unit-tests/test/script/lexer/second-token.test8
-rw-r--r--unit-tests/test/script/parser/driver.cxx2
-rw-r--r--unit-tests/test/script/parser/here-document.test16
6 files changed, 31 insertions, 5 deletions
diff --git a/unit-tests/test/script/lexer/buildfile b/unit-tests/test/script/lexer/buildfile
index 856d35d..fab61b6 100644
--- a/unit-tests/test/script/lexer/buildfile
+++ b/unit-tests/test/script/lexer/buildfile
@@ -8,6 +8,6 @@ import libs = libbutl%lib{butl}
src = token lexer diagnostics utility variable name test/script/{token lexer}
exe{driver}: cxx{driver} ../../../../build2/cxx{$src} $libs \
-test{script-line assign-line variable-line variable comment}
+test{script-line first-token second-token variable-line variable comment}
include ../../../../build2/
diff --git a/unit-tests/test/script/lexer/driver.cxx b/unit-tests/test/script/lexer/driver.cxx
index e37e29d..bda21e4 100644
--- a/unit-tests/test/script/lexer/driver.cxx
+++ b/unit-tests/test/script/lexer/driver.cxx
@@ -30,7 +30,8 @@ namespace build2
string s (argv[1]);
if (s == "script-line") m = lexer_mode::script_line;
- else if (s == "assign-line") m = lexer_mode::assign_line;
+ else if (s == "first-token") m = lexer_mode::second_token;
+ else if (s == "second-token") m = lexer_mode::first_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;
@@ -44,7 +45,8 @@ namespace build2
// Some modes auto-expire so we need something underneath.
//
- bool u (m == lexer_mode::assign_line ||
+ bool u (m == lexer_mode::first_token ||
+ m == lexer_mode::second_token ||
m == lexer_mode::variable_line ||
m == lexer_mode::variable);
diff --git a/unit-tests/test/script/lexer/assign-line.test b/unit-tests/test/script/lexer/first-token.test
index ce3e8a1..a665fed 100644
--- a/unit-tests/test/script/lexer/assign-line.test
+++ b/unit-tests/test/script/lexer/first-token.test
@@ -1,6 +1,6 @@
# Note: this mode auto-expires after each token.
#
-test.arguments += assign-line
+test.arguments += first-token
$* <";" >>EOO # semi-only
;
diff --git a/unit-tests/test/script/lexer/second-token.test b/unit-tests/test/script/lexer/second-token.test
new file mode 100644
index 0000000..a665fed
--- /dev/null
+++ b/unit-tests/test/script/lexer/second-token.test
@@ -0,0 +1,8 @@
+# Note: this mode auto-expires after each token.
+#
+test.arguments += first-token
+
+$* <";" >>EOO # semi-only
+;
+<newline>
+EOO
diff --git a/unit-tests/test/script/parser/driver.cxx b/unit-tests/test/script/parser/driver.cxx
index 4fd0489..6e3fed5 100644
--- a/unit-tests/test/script/parser/driver.cxx
+++ b/unit-tests/test/script/parser/driver.cxx
@@ -70,7 +70,7 @@ namespace build2
{
tracer trace ("main");
- init (1); // Default verbosity.
+ init ("false", 1); // No build system driver, default verbosity.
reset (strings ()); // No command line variables.
bool scope (false);
diff --git a/unit-tests/test/script/parser/here-document.test b/unit-tests/test/script/parser/here-document.test
index 13b070a..d6b21fd 100644
--- a/unit-tests/test/script/parser/here-document.test
+++ b/unit-tests/test/script/parser/here-document.test
@@ -1,4 +1,20 @@
+$* <<EOI >>EOO # blank-lines
+cmd <<EOF
+foo
+
+bar
+
+EOF
+EOI
+cmd <<EOF
+foo
+
+bar
+
+EOF
+EOO
+
# quote
#
# Note: they are still recognized in eval contexts.