aboutsummaryrefslogtreecommitdiff
path: root/unit-tests/function
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-09-08 16:16:11 +0200
committerKaren Arutyunov <karen@codesynthesis.com>2017-09-11 13:57:29 +0300
commitffa0839de796fbefc48bacc4777648ff19b3fee6 (patch)
tree0f493314df633b6f35f9b9db78c7163506c8eed1 /unit-tests/function
parent66e516ad81225b888469b24e726095533c4f9c4c (diff)
Add ability to pass scope to buildfile functions, add $install.resolve()
Diffstat (limited to 'unit-tests/function')
-rw-r--r--unit-tests/function/driver.cxx20
1 files changed, 18 insertions, 2 deletions
diff --git a/unit-tests/function/driver.cxx b/unit-tests/function/driver.cxx
index 4650a18..9286a48 100644
--- a/unit-tests/function/driver.cxx
+++ b/unit-tests/function/driver.cxx
@@ -22,6 +22,17 @@ namespace build2
&value_traits<bool>::value_type
};
+ static dir_path
+ scoped (const scope&, dir_path d)
+ {
+ return d;
+ }
+
+ static void
+ scoped_void (const scope&, dir_path)
+ {
+ }
+
int
main (int, char* argv[])
{
@@ -43,6 +54,11 @@ namespace build2
f["ambig"] = [](names a, optional<string>) {return a;};
f["ambig"] = [](names a, optional<uint64_t>) {return a;};
+ f["scoped"] = [](const scope&, names a) {return a;};
+ f["scoped_void"] = [](const scope&, names) {};
+ f["scoped"] = &scoped;
+ f["scoped_void"] = &scoped_void;
+
f[".qual"] = []() {return "abc";};
f[".length"] = &path::size; // Member function.
@@ -60,7 +76,7 @@ namespace build2
1,
function_overload::arg_variadic,
function_overload::types (arg_bool, 1),
- [] (vector_view<value> args, const function_overload&)
+ [] (const scope&, vector_view<value> args, const function_overload&)
{
return value (static_cast<uint64_t> (args.size ()));
}));
@@ -74,7 +90,7 @@ namespace build2
0,
function_overload::arg_variadic,
function_overload::types (),
- [] (vector_view<value> args, const function_overload&)
+ [] (const scope&, vector_view<value> args, const function_overload&)
{
for (value& a: args)
{