aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-07 14:29:36 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-07 14:29:36 +0000
commitb4cace022fa5a240a38a6e8e612cd38c85e2c0d4 (patch)
treea898fe1fe5584bee272d569b5cd957927bf799d5
parenta47dcf581e0dcff0ec9d2b5a56e0af25f4303d2a (diff)
downloadpaludis-b4cace022fa5a240a38a6e8e612cd38c85e2c0d4.tar.gz
paludis-b4cace022fa5a240a38a6e8e612cd38c85e2c0d4.tar.xz
Extend portage repository test coverage
-rw-r--r--paludis/portage_repository_TEST.cc38
-rwxr-xr-xpaludis/portage_repository_TEST_setup.sh8
2 files changed, 43 insertions, 3 deletions
diff --git a/paludis/portage_repository_TEST.cc b/paludis/portage_repository_TEST.cc
index 48c6af6..b2c5cb0 100644
--- a/paludis/portage_repository_TEST.cc
+++ b/paludis/portage_repository_TEST.cc
@@ -287,5 +287,43 @@ namespace test_cases
}
} test_portage_repository_bad_package_names;
+ struct PortageRepositoryHasVersionTest : TestCase
+ {
+ PortageRepositoryHasVersionTest() : TestCase("has version") { }
+
+ 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);
+
+ TEST_CHECK(repo->has_version(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("1")));
+ TEST_CHECK(repo->has_version(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("1.1-r1")));
+ TEST_CHECK(! repo->has_version(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("2")));
+
+ TEST_CHECK(repo->has_version(QualifiedPackageName("cat-one/pkg-both"), VersionSpec("3.45")));
+ TEST_CHECK(! repo->has_version(QualifiedPackageName("cat-one/pkg-both"), VersionSpec("1")));
+ TEST_CHECK(! repo->has_version(QualifiedPackageName("cat-one/pkg-both"), VersionSpec("1.23")));
+
+ TEST_CHECK(repo->has_version(QualifiedPackageName("cat-two/pkg-two"), VersionSpec("2")));
+ TEST_CHECK(! repo->has_version(QualifiedPackageName("cat-two/pkg-two"), VersionSpec("1")));
+
+ TEST_CHECK(! repo->has_version(QualifiedPackageName("cat-two/pkg-both"), VersionSpec("3.45")));
+ TEST_CHECK(! repo->has_version(QualifiedPackageName("cat-two/pkg-both"), VersionSpec("1")));
+ TEST_CHECK(repo->has_version(QualifiedPackageName("cat-two/pkg-both"), VersionSpec("1.23")));
+
+ TEST_CHECK(! repo->has_version(QualifiedPackageName("cat-two/pkg-neither"), VersionSpec("1")));
+ }
+ }
+ } test_portage_repository_has_version;
+
}
diff --git a/paludis/portage_repository_TEST_setup.sh b/paludis/portage_repository_TEST_setup.sh
index 520b07a..6b25a41 100755
--- a/paludis/portage_repository_TEST_setup.sh
+++ b/paludis/portage_repository_TEST_setup.sh
@@ -51,11 +51,13 @@ ARCH=test
END
cat <<END > cat-one/pkg-one/pkg-one-1.ebuild || exit 1
END
-cat <<END > cat-one/pkg-both/pkg-both-1.ebuild || exit 1
+cat <<END > cat-one/pkg-one/pkg-one-1.1-r1.ebuild || exit 1
END
-cat <<END > cat-two/pkg-two/pkg-two-1.ebuild || exit 1
+cat <<END > cat-one/pkg-both/pkg-both-3.45.ebuild || exit 1
END
-cat <<END > cat-two/pkg-both/pkg-both-1.ebuild || exit 1
+cat <<END > cat-two/pkg-two/pkg-two-2.ebuild || exit 1
+END
+cat <<END > cat-two/pkg-both/pkg-both-1.23.ebuild || exit 1
END
cd ..