aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/e/exndbam_repository_TEST.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-06-30 05:34:25 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-06-30 05:34:25 +0100
commita7eff252d935e5654a2e039dff6cce547e4fd999 (patch)
tree1964a54d33dfdbb21ea99db24ec5a240cabb6eae /paludis/repositories/e/exndbam_repository_TEST.cc
parent8e4a4a04e8e87102f97f75485c772c5cf408742c (diff)
downloadpaludis-a7eff252d935e5654a2e039dff6cce547e4fd999.tar.gz
paludis-a7eff252d935e5654a2e039dff6cce547e4fd999.tar.xz
Make repository_defaults.conf work again.
Rather than passing a map to the repository VC, we pass a function. This means we don't have to iterate over a KeyValueConfigFile's keys, which doesn't work well with a defaults function. Fixes: ticket:609. Squashed commit of the following: commit 47b484222ad25a47c088af5eec332219ece400c6 Author: Ciaran McCreesh <ciaran.mccreesh@googlemail.com> Date: Mon Jun 30 05:33:41 2008 +0100 moar commit 653477eb3f89044ef1fbd5d878c54acb6afc27e8 Author: Ciaran McCreesh <ciaran.mccreesh@googlemail.com> Date: Mon Jun 30 04:42:55 2008 +0100 start
Diffstat (limited to 'paludis/repositories/e/exndbam_repository_TEST.cc')
-rw-r--r--paludis/repositories/e/exndbam_repository_TEST.cc21
1 files changed, 16 insertions, 5 deletions
diff --git a/paludis/repositories/e/exndbam_repository_TEST.cc b/paludis/repositories/e/exndbam_repository_TEST.cc
index c8091a8f5..b6072e0b3 100644
--- a/paludis/repositories/e/exndbam_repository_TEST.cc
+++ b/paludis/repositories/e/exndbam_repository_TEST.cc
@@ -19,18 +19,28 @@
#include <paludis/repositories/e/exndbam_repository.hh>
#include <paludis/environments/test/test_environment.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
using namespace test;
using namespace paludis;
+namespace
+{
+ std::string from_keys(const std::tr1::shared_ptr<const Map<std::string, std::string> > & m,
+ const std::string & k)
+ {
+ Map<std::string, std::string>::ConstIterator mm(m->find(k));
+ if (m->end() == mm)
+ return "";
+ else
+ return mm->second;
+ }
+}
+
namespace test_cases
{
- /**
- * \test Test VDBRepository repo names
- *
- */
struct ExndbamRepositoryRepoNameTest : TestCase
{
ExndbamRepositoryRepoNameTest() : TestCase("repo name") { }
@@ -41,7 +51,8 @@ namespace test_cases
std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
keys->insert("format", "exndbam");
keys->insert("location", "exndbam_repository_TEST_dir/repo1");
- std::tr1::shared_ptr<Repository> repo(ExndbamRepository::make_exndbam_repository(&env, keys));
+ std::tr1::shared_ptr<Repository> repo(ExndbamRepository::make_exndbam_repository(&env,
+ std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
TEST_CHECK_STRINGIFY_EQUAL(repo->name(), "installed");
}
} test_exndbam_repository_repo_name;