aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/e/e_repository_TEST_4.cc
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2012-09-08 16:25:45 +0100
committerAvatar David Leverton <levertond@googlemail.com> 2012-09-08 16:25:45 +0100
commit714dd6f3faaf0d78ff1b531eeecfa87a970d4d69 (patch)
tree6ddc4daefc354e04e1be934ea4e1a274b8d95c15 /paludis/repositories/e/e_repository_TEST_4.cc
parentfe67468145178e13d5100cb62dce98195e1d56f2 (diff)
downloadpaludis-714dd6f3faaf0d78ff1b531eeecfa87a970d4d69.tar.gz
paludis-714dd6f3faaf0d78ff1b531eeecfa87a970d4d69.tar.xz
Add usex function for EAPI 5
Diffstat (limited to 'paludis/repositories/e/e_repository_TEST_4.cc')
-rw-r--r--paludis/repositories/e/e_repository_TEST_4.cc46
1 files changed, 46 insertions, 0 deletions
diff --git a/paludis/repositories/e/e_repository_TEST_4.cc b/paludis/repositories/e/e_repository_TEST_4.cc
index e8a1a569d..5bdfd99ff 100644
--- a/paludis/repositories/e/e_repository_TEST_4.cc
+++ b/paludis/repositories/e/e_repository_TEST_4.cc
@@ -552,3 +552,49 @@ TEST(ERepository, RequiredUse)
}
}
+TEST(ERepository, NoUseX)
+{
+ FSPath root(FSPath::cwd() / "e_repository_TEST_4_dir" / "root");
+
+ TestEnvironment env;
+ std::shared_ptr<Map<std::string, std::string> > keys(std::make_shared<Map<std::string, std::string>>());
+ keys->insert("format", "e");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("location", stringify(FSPath::cwd() / "e_repository_TEST_4_dir" / "repo"));
+ keys->insert("profiles", stringify(FSPath::cwd() / "e_repository_TEST_4_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(FSPath::cwd() / "e_repository_TEST_4_dir" / "distdir"));
+ keys->insert("builddir", stringify(FSPath::cwd() / "e_repository_TEST_4_dir" / "build"));
+ std::shared_ptr<Repository> repo(ERepository::repository_factory_create(&env,
+ std::bind(from_keys, keys, std::placeholders::_1)));
+ env.add_repository(1, repo);
+
+ std::shared_ptr<FakeInstalledRepository> installed_repo(std::make_shared<FakeInstalledRepository>(
+ make_named_values<FakeInstalledRepositoryParams>(
+ n::environment() = &env,
+ n::name() = RepositoryName("installed"),
+ n::suitable_destination() = true,
+ n::supports_uninstall() = true
+ )));
+ env.add_repository(2, installed_repo);
+
+ {
+ PretendAction pretend_action(make_named_values<PretendActionOptions>(
+ n::destination() = installed_repo,
+ n::make_output_manager() = &make_standard_output_manager,
+ n::replacing() = std::make_shared<PackageIDSequence>()
+ ));
+
+ const std::shared_ptr<const PackageID> id(*env[selection::RequireExactlyOne(generator::Matches(
+ PackageDepSpec(parse_user_package_dep_spec("=cat/no-usex-4::test-repo",
+ &env, { })), make_null_shared_ptr(), { }))]->last());
+ ASSERT_TRUE(bool(id));
+ EXPECT_EQ("4", visitor_cast<const MetadataValueKey<std::string> >(**id->find_metadata("EAPI"))->parse_value());
+ id->perform_action(pretend_action);
+ ASSERT_TRUE(! pretend_action.failed());
+ }
+}
+