diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-12-16 17:23:54 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-12-16 17:23:54 +0200 |
commit | 3ab61fbc2ce25afa617ed6bb50c2f8d701beeaba (patch) | |
tree | aa1357f78905a3383871c0cdd55ef384f564780e /build2/test/rule.cxx | |
parent | 75152526696fc024628796f0633ed695d5ebc49c (diff) |
Add support for passing target name to testscript via test variable
Such a targets is automatically resolved and converted to path.
Diffstat (limited to 'build2/test/rule.cxx')
-rw-r--r-- | build2/test/rule.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
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<path> (l).string () != "false"; + const name* n (cast_null<name> (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<name> (p.first)); - if (p.first && cast<path> (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 = |