aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/fake
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/repositories/fake')
-rw-r--r--paludis/repositories/fake/fake_installed_repository.cc15
-rw-r--r--paludis/repositories/fake/fake_installed_repository.hh23
-rw-r--r--paludis/repositories/fake/fake_installed_repository_TEST.cc11
3 files changed, 40 insertions, 9 deletions
diff --git a/paludis/repositories/fake/fake_installed_repository.cc b/paludis/repositories/fake/fake_installed_repository.cc
index e07076ca3..80afb5d3c 100644
--- a/paludis/repositories/fake/fake_installed_repository.cc
+++ b/paludis/repositories/fake/fake_installed_repository.cc
@@ -56,9 +56,8 @@ namespace paludis
};
}
-FakeInstalledRepository::FakeInstalledRepository(const Environment * const e, const RepositoryName & our_name,
- const bool supports_uninstall, const bool i) :
- FakeRepositoryBase(e, our_name, make_named_values<RepositoryCapabilities>(
+FakeInstalledRepository::FakeInstalledRepository(const FakeInstalledRepositoryParams & p) :
+ FakeRepositoryBase(p.environment(), p.name(), make_named_values<RepositoryCapabilities>(
value_for<n::destination_interface>(this),
value_for<n::e_interface>(static_cast<RepositoryEInterface *>(0)),
value_for<n::environment_variable_interface>(static_cast<RepositoryEnvironmentVariableInterface *>(0)),
@@ -68,7 +67,8 @@ FakeInstalledRepository::FakeInstalledRepository(const Environment * const e, co
value_for<n::provides_interface>(this),
value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0))
)),
- PrivateImplementationPattern<FakeInstalledRepository>(new Implementation<FakeInstalledRepository>(supports_uninstall, i)),
+ PrivateImplementationPattern<FakeInstalledRepository>(new Implementation<FakeInstalledRepository>(
+ p.supports_uninstall(), p.suitable_destination())),
_imp(PrivateImplementationPattern<FakeInstalledRepository>::_imp)
{
add_metadata_key(_imp->format_key);
@@ -225,7 +225,12 @@ FakeInstalledRepository::repository_factory_create(
Context context("When creating FakeInstalledRepository:");
RepositoryName name(f("name"));
- return make_shared_ptr(new FakeInstalledRepository(env, name));
+ return make_shared_ptr(new FakeInstalledRepository(make_named_values<FakeInstalledRepositoryParams>(
+ value_for<n::environment>(env),
+ value_for<n::name>(name),
+ value_for<n::suitable_destination>(true),
+ value_for<n::supports_uninstall>(true)
+ )));
}
std::tr1::shared_ptr<const RepositoryNameSet>
diff --git a/paludis/repositories/fake/fake_installed_repository.hh b/paludis/repositories/fake/fake_installed_repository.hh
index a566d3a7c..c61a0b88c 100644
--- a/paludis/repositories/fake/fake_installed_repository.hh
+++ b/paludis/repositories/fake/fake_installed_repository.hh
@@ -24,6 +24,25 @@
namespace paludis
{
+ namespace n
+ {
+ struct environment;
+ struct name;
+ struct suitable_destination;
+ struct supports_uninstall;
+ }
+
+ /**
+ * Parameters for a FakeInstalledRepository.
+ */
+ struct FakeInstalledRepositoryParams
+ {
+ NamedValue<n::environment, const Environment *> environment;
+ NamedValue<n::name, RepositoryName> name;
+ NamedValue<n::suitable_destination, bool> suitable_destination;
+ NamedValue<n::supports_uninstall, bool> supports_uninstall;
+ };
+
/**
* A fake repository for test cases, for installed packages.
*
@@ -61,8 +80,8 @@ namespace paludis
///\name Basic operations
///\{
- FakeInstalledRepository(const Environment * const, const RepositoryName &, const bool supports_uninstall = true,
- const bool suitable_destination = true);
+ ///\since 0.42
+ FakeInstalledRepository(const FakeInstalledRepositoryParams &);
~FakeInstalledRepository();
///\}
diff --git a/paludis/repositories/fake/fake_installed_repository_TEST.cc b/paludis/repositories/fake/fake_installed_repository_TEST.cc
index e9999f8f3..362d0da90 100644
--- a/paludis/repositories/fake/fake_installed_repository_TEST.cc
+++ b/paludis/repositories/fake/fake_installed_repository_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh
*
* 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
@@ -21,6 +21,7 @@
#include <test/test_framework.hh>
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/environments/test/test_environment.hh>
+#include <paludis/util/make_named_values.hh>
using namespace test;
using namespace paludis;
@@ -34,7 +35,13 @@ namespace test_cases
void run()
{
TestEnvironment env;
- std::tr1::shared_ptr<const FakeInstalledRepository> r(new FakeInstalledRepository(&env, RepositoryName("fake")));
+ std::tr1::shared_ptr<const FakeInstalledRepository> r(new FakeInstalledRepository(
+ make_named_values<FakeInstalledRepositoryParams>(
+ value_for<n::environment>(&env),
+ value_for<n::name>(RepositoryName("fake")),
+ value_for<n::suitable_destination>(true),
+ value_for<n::supports_uninstall>(true)
+ )));
}
} test_fake_installed_repository;
}