aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/e/e_repository_TEST_3.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-12-14 18:33:36 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-12-14 18:33:36 +0000
commit022f4dd439abfeffad3bf9d822306a47102874e6 (patch)
treef7c05811c63bafbd5fd25186a08a87459f2e3a30 /paludis/repositories/e/e_repository_TEST_3.cc
parentdee918a74ce99cb059de73f0ea9369cecbdf9567 (diff)
downloadpaludis-022f4dd439abfeffad3bf9d822306a47102874e6.tar.gz
paludis-022f4dd439abfeffad3bf9d822306a47102874e6.tar.xz
EAPI 3 is EAPI 4 now
Diffstat (limited to 'paludis/repositories/e/e_repository_TEST_3.cc')
-rw-r--r--paludis/repositories/e/e_repository_TEST_3.cc268
1 files changed, 0 insertions, 268 deletions
diff --git a/paludis/repositories/e/e_repository_TEST_3.cc b/paludis/repositories/e/e_repository_TEST_3.cc
deleted file mode 100644
index d57ee76f5..000000000
--- a/paludis/repositories/e/e_repository_TEST_3.cc
+++ /dev/null
@@ -1,268 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 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
- * 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/repositories/e/e_repository.hh>
-#include <paludis/repositories/e/e_repository_exceptions.hh>
-#include <paludis/repositories/e/e_repository_id.hh>
-#include <paludis/repositories/e/vdb_repository.hh>
-#include <paludis/repositories/e/eapi.hh>
-#include <paludis/repositories/e/dep_spec_pretty_printer.hh>
-#include <paludis/repositories/fake/fake_installed_repository.hh>
-#include <paludis/repositories/fake/fake_package_id.hh>
-#include <paludis/environments/test/test_environment.hh>
-#include <paludis/util/system.hh>
-#include <paludis/util/simple_visitor_cast.hh>
-#include <paludis/util/map.hh>
-#include <paludis/util/make_shared_ptr.hh>
-#include <paludis/util/make_named_values.hh>
-#include <paludis/util/set.hh>
-#include <paludis/standard_output_manager.hh>
-#include <paludis/util/safe_ifstream.hh>
-#include <paludis/package_id.hh>
-#include <paludis/metadata_key.hh>
-#include <paludis/action.hh>
-#include <paludis/stringify_formatter.hh>
-#include <paludis/user_dep_spec.hh>
-#include <paludis/generator.hh>
-#include <paludis/filter.hh>
-#include <paludis/filtered_generator.hh>
-#include <paludis/selection.hh>
-#include <paludis/repository_factory.hh>
-#include <paludis/choice.hh>
-#include <test/test_framework.hh>
-#include <test/test_runner.hh>
-#include <tr1/functional>
-#include <set>
-#include <string>
-
-#include "config.h"
-
-using namespace test;
-using namespace paludis;
-
-namespace
-{
- void cannot_uninstall(const std::tr1::shared_ptr<const PackageID> & id, const UninstallActionOptions &)
- {
- if (id)
- throw InternalError(PALUDIS_HERE, "cannot uninstall");
- }
-
- std::tr1::shared_ptr<OutputManager> make_standard_output_manager(const Action &)
- {
- return make_shared_ptr(new StandardOutputManager);
- }
-
- 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;
- }
-
- WantPhase want_all_phases(const std::string &)
- {
- return wp_yes;
- }
-}
-
-namespace test_cases
-{
- struct ERepositoryInstallEAPI3Test : TestCase
- {
- ERepositoryInstallEAPI3Test() : TestCase("install_eapi_3") { }
-
- unsigned max_run_time() const
- {
- return 3000;
- }
-
- bool repeatable() const
- {
- return false;
- }
-
- void run()
- {
- TestEnvironment env;
- env.set_paludis_command("/bin/false");
- std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>);
- keys->insert("format", "ebuild");
- keys->insert("names_cache", "/var/empty");
- keys->insert("location", stringify(FSEntry::cwd() / "e_repository_TEST_3_dir" / "repo"));
- keys->insert("profiles", stringify(FSEntry::cwd() / "e_repository_TEST_3_dir" / "repo/profiles/profile"));
- keys->insert("layout", "traditional");
- keys->insert("eapi_when_unknown", "0");
- keys->insert("eapi_when_unspecified", "0");
- keys->insert("profile_eapi", "0");
- keys->insert("distdir", stringify(FSEntry::cwd() / "e_repository_TEST_3_dir" / "distdir"));
- keys->insert("builddir", stringify(FSEntry::cwd() / "e_repository_TEST_3_dir" / "build"));
- std::tr1::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
- std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)));
- env.package_database()->add_repository(1, repo);
-
- std::tr1::shared_ptr<FakeInstalledRepository> installed_repo(new FakeInstalledRepository(
- make_named_values<FakeInstalledRepositoryParams>(
- value_for<n::environment>(&env),
- value_for<n::name>(RepositoryName("installed")),
- value_for<n::suitable_destination>(true),
- value_for<n::supports_uninstall>(true)
- )));
- env.package_database()->add_repository(2, installed_repo);
-
- InstallAction action(make_named_values<InstallActionOptions>(
- value_for<n::destination>(installed_repo),
- value_for<n::make_output_manager>(&make_standard_output_manager),
- value_for<n::perform_uninstall>(&cannot_uninstall),
- value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::want_phase>(&want_all_phases)
- ));
-
- PretendAction pretend_action(make_named_values<PretendActionOptions>(
- value_for<n::make_output_manager>(&make_standard_output_manager)
- ));
-
- {
- TestMessageSuffix suffix("pkg_pretend", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/pkg_pretend-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- id->perform_action(pretend_action);
- TEST_CHECK(! pretend_action.failed());
- }
-
- {
- TestMessageSuffix suffix("pkg_pretend-failure", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/pkg_pretend-failure-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- id->perform_action(pretend_action);
- TEST_CHECK(pretend_action.failed());
- }
-
- {
- TestMessageSuffix suffix("default_src_install 3", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/default_src_install-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("docompress 3", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/docompress-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("dodoc -r", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/dodoc-r-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("doins symlink", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/doins-symlink-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("banned functions 3", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/banned-functions-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
- }
-
- {
- TestMessageSuffix suffix("econf disable dependency tracking", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/econf-disable-dependency-tracking-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("strict use", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/strict-use-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("strict use fail", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/strict-use-fail-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- TEST_CHECK_THROWS(id->perform_action(action), ActionFailedError);
- }
-
- {
- TestMessageSuffix suffix("strict use injection", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/strict-use-injection-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- id->perform_action(action);
- }
-
- {
- TestMessageSuffix suffix("global scope use", true);
- const std::tr1::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
- PackageDepSpec(parse_user_package_dep_spec("=cat/global-scope-use-3",
- &env, UserPackageDepSpecOptions())), MatchPackageOptions()))]->last());
- TEST_CHECK(id);
- TEST_CHECK_EQUAL(simple_visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->value(), "3");
- id->perform_action(action);
- }
- }
- } test_e_repository_install_eapi_3;
-}
-