aboutsummaryrefslogtreecommitdiff
path: root/unit-tests
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-03-16 10:35:32 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-03-16 18:15:18 +0200
commitece4003beebd23082a5fd7a324de40c5572161d1 (patch)
tree44597a24266b31e55b27b7393d2d20c729603d95 /unit-tests
parentd2b324a72fdf16fcd68e6ba7ca0280aa95de4b71 (diff)
Add support for passing parameters to (meta-) operations
Diffstat (limited to 'unit-tests')
-rw-r--r--unit-tests/lexer/buildfile2
-rw-r--r--unit-tests/lexer/buildspec.test16
-rw-r--r--unit-tests/lexer/driver.cxx4
3 files changed, 21 insertions, 1 deletions
diff --git a/unit-tests/lexer/buildfile b/unit-tests/lexer/buildfile
index 520d17c..47c9e45 100644
--- a/unit-tests/lexer/buildfile
+++ b/unit-tests/lexer/buildfile
@@ -12,6 +12,6 @@ functions-target-triplet algorithm search dump filesystem scheduler \
config/{utility init operation}
exe{driver}: cxx{driver} ../../build2/cxx{$src} ../../build2/liba{b} $libs \
-test{comment eval quoting}
+test{*}
include ../../build2/
diff --git a/unit-tests/lexer/buildspec.test b/unit-tests/lexer/buildspec.test
new file mode 100644
index 0000000..81eeb00
--- /dev/null
+++ b/unit-tests/lexer/buildspec.test
@@ -0,0 +1,16 @@
+# file : unit-tests/lexer/buildspec.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+test.arguments = buildspec
+
+: punctuation
+:
+$* <:'x,x(x)' >>EOO
+'x'
+,
+'x'
+ (
+'x'
+)
+EOO
diff --git a/unit-tests/lexer/driver.cxx b/unit-tests/lexer/driver.cxx
index e9ccd63..41366ec 100644
--- a/unit-tests/lexer/driver.cxx
+++ b/unit-tests/lexer/driver.cxx
@@ -36,6 +36,7 @@ namespace build2
else if (a == "value") m = lexer_mode::value;
else if (a == "attribute") m = lexer_mode::attribute;
else if (a == "eval") m = lexer_mode::eval;
+ else if (a == "buildspec") m = lexer_mode::buildspec;
else assert (false);
break;
}
@@ -56,6 +57,9 @@ namespace build2
//
for (token t (l.next ()); t.type != token_type::eos; t = l.next ())
{
+ if (t.separated && t.type != token_type::newline)
+ cout << ' ';
+
// Print each token on a separate line without quoting operators.
//
t.printer (cout, t, false);