aboutsummaryrefslogtreecommitdiff
path: root/tests/build-class-expr
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-12-07 21:38:00 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-12-11 13:59:03 +0300
commitfbabb3ddf7f9bee71a6be767cc911b5b3b96333a (patch)
treeaa3b31024f2fb0c6b53961afbfe9de2a6ba29cb8 /tests/build-class-expr
parentb05ca3928c826b46a087f3e1f8ff24069c65ff0b (diff)
Add support for build configuration class inheritance
Diffstat (limited to 'tests/build-class-expr')
-rw-r--r--tests/build-class-expr/driver.cxx25
-rw-r--r--tests/build-class-expr/testscript17
2 files changed, 37 insertions, 5 deletions
diff --git a/tests/build-class-expr/driver.cxx b/tests/build-class-expr/driver.cxx
index 343c3b5..586d459 100644
--- a/tests/build-class-expr/driver.cxx
+++ b/tests/build-class-expr/driver.cxx
@@ -14,7 +14,7 @@
// Usages:
//
// argv[0] -p
-// argv[0] [<classes>]
+// argv[0] [<class>[:<base>]]*
//
// Parse stdin lines as build configuration class expressions and print them
// or evaluate.
@@ -47,13 +47,28 @@ main (int argc, char* argv[])
cin.exceptions (ios::badbit);
strings cs;
+ build_class_inheritance_map im;
if (print)
cout.exceptions (ios::failbit | ios::badbit);
else
{
for (int i (1); i != argc; ++i)
- cs.push_back (argv[i]);
+ {
+ string c (argv[i]);
+
+ string base;
+ size_t p (c.find (':'));
+
+ if (p != string::npos)
+ {
+ base = string (c, p + 1);
+ c.resize (p);
+ }
+
+ im[c] = move (base);
+ cs.emplace_back (move (c));
+ }
}
try
@@ -77,18 +92,18 @@ main (int argc, char* argv[])
if (!underlying_cls->empty ())
{
build_class_expr expr (*underlying_cls, '+', "" /* comment */);
- expr.match (cs, r);
+ expr.match (cs, im, r);
}
}
- expr.match (cs, r);
+ expr.match (cs, im, r);
}
}
if (underlying_cls && !underlying_cls->empty ())
{
build_class_expr expr (*underlying_cls, '&', "" /* comment */);
- expr.match (cs, r);
+ expr.match (cs, im, r);
}
return print || r ? 0 : 1;
diff --git a/tests/build-class-expr/testscript b/tests/build-class-expr/testscript
index cfa1400..006d12d 100644
--- a/tests/build-class-expr/testscript
+++ b/tests/build-class-expr/testscript
@@ -88,6 +88,14 @@
{
$* <'+!x'
}
+
+ : base
+ :
+ {
+ test.arguments += a:x b:y c
+
+ $* <'+y'
+ }
}
: mismatch
@@ -122,4 +130,13 @@
{
$* <'+a' == 1
}
+
+
+ : base
+ :
+ {
+ test.arguments += a:x b:y c
+
+ $* <'+z' == 1
+ }
}