From 096c98c77269a3e7ad151dd7788e9d96f8f8267d Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 28 Oct 2016 14:01:51 +0300 Subject: Suppress duplicates on test scope path cleanup registration --- build2/test/script/script.cxx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'build2/test/script/script.cxx') 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 #include +#include // find() #include @@ -287,6 +288,26 @@ namespace build2 const_cast (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:: -- cgit v1.1