diff options
Diffstat (limited to 'build2/test/target.cxx')
-rw-r--r-- | build2/test/target.cxx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/build2/test/target.cxx b/build2/test/target.cxx index 3bf00c1..b6f9854 100644 --- a/build2/test/target.cxx +++ b/build2/test/target.cxx @@ -34,12 +34,35 @@ namespace build2 return *tk.name == "testscript" ? string () : "test"; } + static bool + testscript_target_pattern (const target_type&, + const scope&, + string& v, + bool r) + { + size_t p (path::traits::find_extension (v)); + + if (r) + { + assert (p != string::npos); + v.resize (p); + } + else if (p == string::npos && v != "testscript") + { + v += ".test"; + return true; + } + + return false; + } + const target_type testscript::static_type { "test", &file::static_type, &testscript_factory, &testscript_target_extension, + &testscript_target_pattern, nullptr, &search_file, false |