aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-31 10:07:28 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-31 10:07:28 +0100
commit511a47f4b65b57ddecd69bde38751ebfb2ce3453 (patch)
treed0f4f7efc71078861b00f8b4ac1ab570f83ff381
parent84fdbf9be567f94bbed02ad285904c95fd6888b2 (diff)
downloadpaludis-511a47f4b65b57ddecd69bde38751ebfb2ce3453.tar.gz
paludis-511a47f4b65b57ddecd69bde38751ebfb2ce3453.tar.xz
Make tests slot aware
-rw-r--r--paludis/resolver/resolver_test.cc22
-rw-r--r--paludis/resolver/resolver_test.hh4
2 files changed, 21 insertions, 5 deletions
diff --git a/paludis/resolver/resolver_test.cc b/paludis/resolver/resolver_test.cc
index ba37e13..4821f8f 100644
--- a/paludis/resolver/resolver_test.cc
+++ b/paludis/resolver/resolver_test.cc
@@ -46,6 +46,7 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/generator.hh>
+#include <paludis/selection.hh>
#include <paludis/elike_slot_requirement.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
@@ -85,12 +86,24 @@ paludis::resolver::resolver_test::initial_constraints_for_fn(
}
std::shared_ptr<Resolvents>
-paludis::resolver::resolver_test::get_resolvents_for_fn(const PackageDepSpec & spec,
+paludis::resolver::resolver_test::get_resolvents_for_fn(
+ const Environment * const env,
+ const PackageDepSpec & spec,
const std::shared_ptr<const SlotName> & slot,
const std::shared_ptr<const Reason> &)
{
- std::shared_ptr<Resolvents> result(std::make_shared<Resolvents>());
- result->push_back(Resolvent(spec, slot ? *slot : SlotName("0"), dt_install_to_slash));
+ auto result(std::make_shared<Resolvents>());
+ if (slot)
+ result->push_back(Resolvent(spec, *slot, dt_install_to_slash));
+ else
+ {
+ auto ids((*env)[selection::BestVersionInEachSlot(
+ generator::Matches(spec, { mpo_ignore_additional_requirements }))]);
+ for (auto i(ids->begin()), i_end(ids->end()) ;
+ i != i_end ; ++i)
+ if ((*i)->slot_key())
+ result->push_back(Resolvent(spec, (*i)->slot_key()->value(), dt_install_to_slash));
+ }
return result;
}
@@ -395,7 +408,8 @@ ResolverTestCase::get_resolver_functions(InitialConstraints & initial_constraint
n::get_initial_constraints_for_fn() =
std::bind(&initial_constraints_for_fn, std::ref(initial_constraints),
std::placeholders::_1),
- n::get_resolvents_for_fn() = &get_resolvents_for_fn,
+ n::get_resolvents_for_fn() = std::bind(&get_resolvents_for_fn, &env, std::placeholders::_1,
+ std::placeholders::_2, std::placeholders::_3),
n::get_use_existing_fn() = &get_use_existing_fn,
n::interest_in_spec_fn() = &interest_in_spec_fn,
n::make_destination_filtered_generator_fn() = &make_destination_filtered_generator_fn,
diff --git a/paludis/resolver/resolver_test.hh b/paludis/resolver/resolver_test.hh
index e1be281..5522b74 100644
--- a/paludis/resolver/resolver_test.hh
+++ b/paludis/resolver/resolver_test.hh
@@ -83,7 +83,9 @@ namespace paludis
const std::shared_ptr<const Resolution> &,
const std::shared_ptr<const Resolution> &);
- std::shared_ptr<Resolvents> get_resolvents_for_fn(const PackageDepSpec & spec,
+ std::shared_ptr<Resolvents> get_resolvents_for_fn(
+ const Environment * const,
+ const PackageDepSpec & spec,
const std::shared_ptr<const SlotName> &,
const std::shared_ptr<const Reason> &);