From 3ab61fbc2ce25afa617ed6bb50c2f8d701beeaba Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 16 Dec 2016 17:23:54 +0200 Subject: Add support for passing target name to testscript via test variable Such a targets is automatically resolved and converted to path. --- build2/test/rule.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'build2/test/rule.cxx') diff --git a/build2/test/rule.cxx b/build2/test/rule.cxx index 0abc233..a8adb9e 100644 --- a/build2/test/rule.cxx +++ b/build2/test/rule.cxx @@ -68,8 +68,8 @@ namespace build2 // We treat this target as testable unless the test variable is // explicitly set to false. // - lookup l (t["test"]); - md.test = !l || cast (l).string () != "false"; + const name* n (cast_null (t["test"])); + md.test = n == nullptr || !n->simple () || n->value != "false"; break; } } @@ -88,14 +88,15 @@ namespace build2 // Use lookup depths to figure out who "overrides" whom. // auto p (t.find ("test")); + const name* n (cast_null (p.first)); - if (p.first && cast (p.first).string () != "false") + if (n != nullptr && n->simple () && n->value != "false") md.test = true; else { - auto test = [&t, &p] (const char* n) + auto test = [&t, &p] (const char* var) { - return t.find (n).second < p.second; + return t.find (var).second < p.second; }; md.test = -- cgit v1.1