diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2016-10-28 14:01:51 +0300 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-04 09:26:36 +0200 |
commit | 096c98c77269a3e7ad151dd7788e9d96f8f8267d (patch) | |
tree | 616b0f61a11fc5d079dd10234765e63df1cb92b9 /build2/test/script/script.cxx | |
parent | 08ae9246421cf2b7269dc09dab2dbd5dc5d0817a (diff) |
Suppress duplicates on test scope path cleanup registration
Diffstat (limited to 'build2/test/script/script.cxx')
-rw-r--r-- | build2/test/script/script.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/build2/test/script/script.cxx b/build2/test/script/script.cxx index bf53595..f1dab63 100644 --- a/build2/test/script/script.cxx +++ b/build2/test/script/script.cxx @@ -5,6 +5,7 @@ #include <build2/test/script/script> #include <sstream> +#include <algorithm> // find() #include <build2/target> @@ -287,6 +288,26 @@ namespace build2 const_cast<dir_path&> (wd_path) = dir_path (p->wd_path) /= id; } + // command + // + void scope:: + clean (const path& p) + { + using std::find; // Hidden by scope::find(). + + if (find (cleanups.begin (), cleanups.end (), p) == cleanups.end ()) + cleanups.emplace_back (p); + } + + void scope:: + clean (path&& p) + { + using std::find; // Hidden by scope::find(). + + if (find (cleanups.begin (), cleanups.end (), p) == cleanups.end ()) + cleanups.emplace_back (move (p)); + } + // script_base // script_base:: |