aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-01-22 15:20:54 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-01-22 15:25:45 +0000
commit32a1cef4f57c4e5a97dced8d7ec1694de289b0fd (patch)
tree89626751209f36f979d22e17bd93ef463b816d1f
parent877928cc0d484a75923c94aed0f25079400939f4 (diff)
downloadpaludis-32a1cef4f57c4e5a97dced8d7ec1694de289b0fd.tar.gz
paludis-32a1cef4f57c4e5a97dced8d7ec1694de289b0fd.tar.xz
Allow checking slots
-rw-r--r--paludis/resolver/resolver_test.cc28
-rw-r--r--paludis/resolver/resolver_test.hh6
2 files changed, 32 insertions, 2 deletions
diff --git a/paludis/resolver/resolver_test.cc b/paludis/resolver/resolver_test.cc
index 73cee77..7af43d3 100644
--- a/paludis/resolver/resolver_test.cc
+++ b/paludis/resolver/resolver_test.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2009, 2010, 2011 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -328,6 +328,16 @@ ResolverTestCase::DecisionChecks::breaking(const QualifiedPackageName & q)
}
ResolverTestCase::DecisionChecks &
+ResolverTestCase::DecisionChecks::change_slot(const QualifiedPackageName & q, const SlotName & s)
+{
+ checks.push_back(std::make_pair(
+ std::bind(&check_change_slot, q, s, std::placeholders::_1),
+ std::bind(&check_change_slot_msg, q, s, std::placeholders::_1)
+ ));
+ return *this;
+}
+
+ResolverTestCase::DecisionChecks &
ResolverTestCase::DecisionChecks::change(const QualifiedPackageName & q)
{
checks.push_back(std::make_pair(
@@ -379,6 +389,16 @@ ResolverTestCase::DecisionChecks::check_change(const QualifiedPackageName & q, c
}
bool
+ResolverTestCase::DecisionChecks::check_change_slot(const QualifiedPackageName & q, const SlotName & s, const std::shared_ptr<const Decision> & d)
+{
+ if (! d)
+ return false;
+
+ return simple_visitor_cast<const ChangesToMakeDecision>(*d) && d->resolvent().package() == q &&
+ d->resolvent().slot().name_or_null() && *d->resolvent().slot().name_or_null() == s;
+}
+
+bool
ResolverTestCase::DecisionChecks::check_breaking(const QualifiedPackageName & q, const std::shared_ptr<const Decision> & d)
{
if (! d)
@@ -412,6 +432,12 @@ ResolverTestCase::DecisionChecks::check_change_msg(const QualifiedPackageName &
}
std::string
+ResolverTestCase::DecisionChecks::check_change_slot_msg(const QualifiedPackageName & q, const SlotName & s, const std::shared_ptr<const Decision> & r)
+{
+ return check_generic_msg(stringify(q) + ":" + stringify(s), r);
+}
+
+std::string
ResolverTestCase::DecisionChecks::check_breaking_msg(const QualifiedPackageName & q, const std::shared_ptr<const Decision> & r)
{
return check_generic_msg("break " + stringify(q), r);
diff --git a/paludis/resolver/resolver_test.hh b/paludis/resolver/resolver_test.hh
index 4f18be2..c34dd79 100644
--- a/paludis/resolver/resolver_test.hh
+++ b/paludis/resolver/resolver_test.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2009, 2010, 2011 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -134,6 +134,9 @@ namespace paludis
static bool check_change(const QualifiedPackageName & q, const std::shared_ptr<const Decision> & r);
static std::string check_change_msg(const QualifiedPackageName & q, const std::shared_ptr<const Decision> & r);
+ static bool check_change_slot(const QualifiedPackageName & q, const SlotName &, const std::shared_ptr<const Decision> & r);
+ static std::string check_change_slot_msg(const QualifiedPackageName & q, const SlotName &, const std::shared_ptr<const Decision> & r);
+
static bool check_remove(const QualifiedPackageName & q, const std::shared_ptr<const Decision> & r);
static std::string check_remove_msg(const QualifiedPackageName & q, const std::shared_ptr<const Decision> & r);
@@ -147,6 +150,7 @@ namespace paludis
static std::string check_finished_msg(const std::shared_ptr<const Decision> & r);
DecisionChecks & change(const QualifiedPackageName & q);
+ DecisionChecks & change_slot(const QualifiedPackageName & q, const SlotName &);
DecisionChecks & remove(const QualifiedPackageName & q);
DecisionChecks & unable(const QualifiedPackageName & q);
DecisionChecks & breaking(const QualifiedPackageName & q);