aboutsummaryrefslogtreecommitdiff
path: root/unit-tests/test/script/lexer
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-10-24 18:00:05 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-11-04 09:26:35 +0200
commit79a83d6dd0f312a5e390f5627f68cc96c4427d33 (patch)
treef66a0a33ea9d18bf1e85d7c4503fc923028edc80 /unit-tests/test/script/lexer
parent2c0a2b0d688b4450c72cde12ecedaa3fc3c9662a (diff)
Add support for setup/teardown commands
Diffstat (limited to 'unit-tests/test/script/lexer')
-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
4 files changed, 14 insertions, 4 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