aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-07 14:45:50 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-07 14:45:50 +0000
commit77028fc1db2d97f4e93f7458e3acce492f034c8c (patch)
treeb502b24f17bc014edd92c0140fe5bf8553f37d67
parentb4cace022fa5a240a38a6e8e612cd38c85e2c0d4 (diff)
downloadpaludis-77028fc1db2d97f4e93f7458e3acce492f034c8c.tar.gz
paludis-77028fc1db2d97f4e93f7458e3acce492f034c8c.tar.xz
Extend portage repository test coverage
-rw-r--r--paludis/portage_repository_TEST.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/paludis/portage_repository_TEST.cc b/paludis/portage_repository_TEST.cc
index b2c5cb0..eb1f50f 100644
--- a/paludis/portage_repository_TEST.cc
+++ b/paludis/portage_repository_TEST.cc
@@ -325,5 +325,42 @@ namespace test_cases
}
} test_portage_repository_has_version;
+
+ struct PortageRepositoryVersionsTest : TestCase
+ {
+ PortageRepositoryVersionsTest() : TestCase("versions") { }
+
+ void run()
+ {
+ TestEnvironment env;
+ std::map<std::string, std::string> keys;
+ keys.insert(std::make_pair("format", "portage"));
+ keys.insert(std::make_pair("location", "portage_repository_TEST_dir/repo4"));
+ keys.insert(std::make_pair("profile", "portage_repository_TEST_dir/repo4/profiles/profile"));
+ PortageRepository::Pointer repo(PortageRepository::make_portage_repository(
+ &env, env.package_database().raw_pointer(), keys));
+
+ for (int pass = 1 ; pass <= 2 ; ++pass)
+ {
+ TestMessageSuffix pass_suffix(stringify(pass), true);
+
+ VersionSpecCollection::ConstPointer versions(0);
+
+ versions = repo->version_specs(QualifiedPackageName("cat-one/pkg-one"));
+ TEST_CHECK(! versions->empty());
+ TEST_CHECK_EQUAL(2, std::distance(versions->begin(), versions->end()));
+ TEST_CHECK(versions->end() != versions->find(VersionSpec("1")));
+ TEST_CHECK(versions->end() != versions->find(VersionSpec("1.1-r1")));
+ TEST_CHECK(versions->end() == versions->find(VersionSpec("2")));
+
+ versions = repo->version_specs(QualifiedPackageName("cat-one/pkg-neither"));
+ TEST_CHECK(versions->empty());
+ TEST_CHECK_EQUAL(0, std::distance(versions->begin(), versions->end()));
+ TEST_CHECK(versions->end() == versions->find(VersionSpec("1")));
+ TEST_CHECK(versions->end() == versions->find(VersionSpec("1.1-r1")));
+ TEST_CHECK(versions->end() == versions->find(VersionSpec("2")));
+ }
+ }
+ } test_portage_repository_versions;
}