aboutsummaryrefslogtreecommitdiff
path: root/paludis/user_dep_spec_TEST.cc
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/user_dep_spec_TEST.cc')
-rw-r--r--paludis/user_dep_spec_TEST.cc33
1 files changed, 29 insertions, 4 deletions
diff --git a/paludis/user_dep_spec_TEST.cc b/paludis/user_dep_spec_TEST.cc
index 2fa1e6e..2da7b49 100644
--- a/paludis/user_dep_spec_TEST.cc
+++ b/paludis/user_dep_spec_TEST.cc
@@ -51,6 +51,24 @@ namespace
return stringify(v.version_operator()) + stringify(v.version_spec());
}
+ std::string stringify_key_constraint(const KeyConstraint & k)
+ {
+ std::string result(k.key());
+
+ switch (k.operation())
+ {
+ case kco_question: result.append("?"); break;
+ case kco_equals: result.append("="); break;
+ case kco_less_than: result.append("<"); break;
+ case kco_greater_than: result.append(">"); break;
+ case last_kco:
+ break;
+ }
+
+ result.append(k.pattern());
+ return "[." + result + "]";
+ }
+
class UserDepSpecTest :
public testing::Test
{
@@ -154,10 +172,17 @@ UserDepSpecTest::check_spec(
EXPECT_TRUE((! spec.additional_requirements_ptr()) || spec.additional_requirements_ptr()->empty());
else
{
- ASSERT_TRUE(bool(spec.additional_requirements_ptr()));
- EXPECT_EQ(additional_requirement, stringify(join(
- indirect_iterator(spec.additional_requirements_ptr()->begin()),
- indirect_iterator(spec.additional_requirements_ptr()->end()), ", ")));
+ ASSERT_TRUE(bool(spec.additional_requirements_ptr()) || bool(spec.all_key_constraints()));
+ std::string x;
+ if (spec.additional_requirements_ptr())
+ x.append(stringify(join(
+ indirect_iterator(spec.additional_requirements_ptr()->begin()),
+ indirect_iterator(spec.additional_requirements_ptr()->end()), ", ")));
+ if (spec.all_key_constraints())
+ x.append(stringify(join(
+ indirect_iterator(spec.all_key_constraints()->begin()),
+ indirect_iterator(spec.all_key_constraints()->end()), ", ", &stringify_key_constraint)));
+ EXPECT_EQ(additional_requirement, x);
}
if (installed_at_path.empty())