aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-18 00:45:50 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-18 00:45:50 +0000
commitf188c1a3e3ee0ec96f1a7fa60db18da82133377c (patch)
tree9193dff519d17407729f2591bb01a2e55ee31ddc
parente32e2c73447fd6c886c975b78b30cc8fbb3a733a (diff)
downloadpaludis-f188c1a3e3ee0ec96f1a7fa60db18da82133377c.tar.gz
paludis-f188c1a3e3ee0ec96f1a7fa60db18da82133377c.tar.xz
Explicitly include fs_entry where needed. Add some very crude vdb repo tests.
-rw-r--r--paludis/files.m42
-rw-r--r--paludis/vdb_repository.hh1
-rw-r--r--paludis/vdb_repository_TEST.cc72
-rwxr-xr-xpaludis/vdb_repository_TEST_cleanup.sh11
-rwxr-xr-xpaludis/vdb_repository_TEST_setup.sh7
5 files changed, 92 insertions, 1 deletions
diff --git a/paludis/files.m4 b/paludis/files.m4
index 5fc6b70..4545c27 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -33,7 +33,7 @@ add(`portage_repository', `hh', `cc', `test', `testscript')
add(`repository', `hh', `cc')
add(`syncer', `hh', `cc')
add(`test_environment', `hh', `cc')
-add(`vdb_repository', `hh', `cc')
+add(`vdb_repository', `hh', `cc', `test', `testscript')
add(`version_metadata', `hh', `cc')
add(`version_operator', `hh', `cc', `test')
add(`version_spec', `hh', `cc', `test')
diff --git a/paludis/vdb_repository.hh b/paludis/vdb_repository.hh
index 33e0be3..0db0f29 100644
--- a/paludis/vdb_repository.hh
+++ b/paludis/vdb_repository.hh
@@ -24,6 +24,7 @@
#include <paludis/util/attributes.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/smart_record.hh>
+#include <paludis/util/fs_entry.hh>
namespace paludis
{
diff --git a/paludis/vdb_repository_TEST.cc b/paludis/vdb_repository_TEST.cc
new file mode 100644
index 0000000..f0a5ff8
--- /dev/null
+++ b/paludis/vdb_repository_TEST.cc
@@ -0,0 +1,72 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+ *
+ * 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/vdb_repository.hh>
+#include <paludis/test_environment.hh>
+#include <test/test_framework.hh>
+#include <test/test_runner.hh>
+
+using namespace test;
+using namespace paludis;
+
+/** \file
+ * Test cases for VDBRepository.
+ *
+ * \ingroup Test
+ */
+
+namespace test_cases
+{
+ struct VDBRepositoryRepoNameTest : TestCase
+ {
+ VDBRepositoryRepoNameTest() : TestCase("repo name") { }
+
+ void run()
+ {
+ TestEnvironment env;
+ std::map<std::string, std::string> keys;
+ keys.insert(std::make_pair("format", "vdb"));
+ keys.insert(std::make_pair("location", "vdb_repository_TEST_dir/repo1"));
+ VDBRepository::Pointer repo(VDBRepository::make_vdb_repository(
+ &env, env.package_database().raw_pointer(), keys));
+ TEST_CHECK_STRINGIFY_EQUAL(repo->name(), "installed");
+ }
+ } test_vdb_repository_repo_name;
+
+ struct VDBRepositoryHasCategoryNamedTest : TestCase
+ {
+ VDBRepositoryHasCategoryNamedTest() : TestCase("has category named") { }
+
+ void run()
+ {
+ TestEnvironment env;
+ std::map<std::string, std::string> keys;
+ keys.insert(std::make_pair("format", "vdb"));
+ keys.insert(std::make_pair("location", "vdb_repository_TEST_dir/repo1"));
+ VDBRepository::Pointer repo(VDBRepository::make_vdb_repository(
+ &env, env.package_database().raw_pointer(), keys));
+
+ TEST_CHECK(repo->has_category_named(CategoryNamePart("cat-one")));
+ TEST_CHECK(repo->has_category_named(CategoryNamePart("cat-two")));
+ TEST_CHECK(! repo->has_category_named(CategoryNamePart("cat-three")));
+ }
+ } test_vdb_repository_has_category_named;
+
+}
+
diff --git a/paludis/vdb_repository_TEST_cleanup.sh b/paludis/vdb_repository_TEST_cleanup.sh
new file mode 100755
index 0000000..13ee375
--- /dev/null
+++ b/paludis/vdb_repository_TEST_cleanup.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d vdb_repository_TEST_dir ] ; then
+ rm -fr vdb_repository_TEST_dir
+else
+ true
+fi
+
+
+
diff --git a/paludis/vdb_repository_TEST_setup.sh b/paludis/vdb_repository_TEST_setup.sh
new file mode 100755
index 0000000..8f3caea
--- /dev/null
+++ b/paludis/vdb_repository_TEST_setup.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir vdb_repository_TEST_dir || exit 1
+cd vdb_repository_TEST_dir || exit 1
+
+mkdir -p repo1/cat-{one/{pkg-one-1,pkg-both-1},two/{pkg-two-2,pkg-both-2}} || exit 1