aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-10-25 13:01:24 +0100
committerAvatar David Leverton <levertond@googlemail.com> 2008-10-25 16:49:00 +0100
commitf0bcca524a3988da301752612f279dfd4ab910d0 (patch)
tree331792a49ac2dd98523114f9f7c7b30d52f04424
parent88df640929231d8fec056df9cfc47aab385aa9ef (diff)
downloadpaludis-f0bcca524a3988da301752612f279dfd4ab910d0.tar.gz
paludis-f0bcca524a3988da301752612f279dfd4ab910d0.tar.xz
Tests for enabled_by_default, and more tests for choices in general.
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc51
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_setup.sh13
2 files changed, 46 insertions, 18 deletions
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index 5a1d1f8..1d215a2 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -575,6 +575,15 @@ namespace test_cases
{
ERepositoryQueryUseTest() : TestCase("USE query") { }
+ void test_choice(const std::tr1::shared_ptr<const PackageID> & p, const std::string & n, bool enabled, bool enabled_by_default, bool locked)
+ {
+ TestMessageSuffix s(stringify(*p) + "[" + n + "]", true);
+ std::tr1::shared_ptr<const ChoiceValue> choice(p->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix(n)));
+ TEST_CHECK_EQUAL(choice->enabled(), enabled);
+ TEST_CHECK_EQUAL(choice->enabled_by_default(), enabled_by_default);
+ TEST_CHECK_EQUAL(choice->locked(), locked);
+ }
+
void run()
{
TestEnvironment env;
@@ -604,20 +613,34 @@ namespace test_cases
PackageDepSpec(parse_user_package_dep_spec("=cat-one/pkg-one-2",
&env, UserPackageDepSpecOptions()))))]->begin());
- TEST_CHECK(p1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag1"))->enabled());
- TEST_CHECK(! p1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag2"))->enabled());
- TEST_CHECK(p1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag3"))->enabled());
- TEST_CHECK(p2->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag5"))->enabled());
- TEST_CHECK(! p1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag5"))->enabled());
- TEST_CHECK(p1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("test"))->enabled());
- TEST_CHECK(! p1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("test2"))->enabled());
-
- TEST_CHECK(p1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag2"))->locked());
- TEST_CHECK(p2->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag3"))->locked());
- TEST_CHECK(! p1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag3"))->locked());
- TEST_CHECK(p4->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("flag3"))->locked());
- TEST_CHECK(p1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("test"))->locked());
- TEST_CHECK(p1->choices_key()->value()->find_by_name_with_prefix(ChoiceNameWithPrefix("test2"))->locked());
+ test_choice(p1, "flag1", true, true, false);
+ test_choice(p1, "flag2", false, false, true);
+ test_choice(p1, "flag3", true, true, false);
+ test_choice(p1, "flag4", true, true, true);
+ test_choice(p1, "flag5", false, false, false);
+ test_choice(p1, "enabled", true, false, false);
+ test_choice(p1, "disabled", false, true, false);
+ test_choice(p1, "enabled2", true, false, false);
+ test_choice(p1, "disabled2", false, true, false);
+ test_choice(p1, "enabled3", false, false, true);
+ test_choice(p1, "disabled3", true, true, true);
+
+ test_choice(p2, "flag1", true, true, false);
+ test_choice(p2, "flag2", false, false, true);
+ test_choice(p2, "flag3", false, false, true);
+ test_choice(p2, "flag4", true, true, true);
+ test_choice(p2, "flag5", true, true, true);
+ test_choice(p2, "flag6", true, true, false);
+
+ test_choice(p4, "flag1", true, true, false);
+ test_choice(p4, "flag2", false, false, true);
+ test_choice(p4, "flag3", false, false, true);
+ test_choice(p4, "flag4", true, true, true);
+ test_choice(p4, "flag5", true, true, false);
+ test_choice(p4, "flag6", false, false, false);
+
+ test_choice(p1, "test", true, true, true);
+ test_choice(p1, "test2", false, false, true);
}
}
} test_e_repository_query_use;
diff --git a/paludis/repositories/e/e_repository_TEST_setup.sh b/paludis/repositories/e/e_repository_TEST_setup.sh
index 1060cd2..941b21e 100755
--- a/paludis/repositories/e/e_repository_TEST_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_setup.sh
@@ -204,13 +204,15 @@ test2
END
cat <<END >profiles/profile/make.defaults || exit 1
ARCH=test
-USE="flag1 flag2 flag3 -flag4 -flag5"
+USE="flag1 flag2 flag3 -flag4 -flag5 -enabled2 disabled2"
END
cat <<END >profiles/profile/use.mask || exit 1
flag2
+enabled3
END
cat <<END >profiles/profile/use.force || exit 1
flag4
+disabled3
END
cat <<END >profiles/profile/package.use.mask || exit 1
cat-two/pkg-two flag3
@@ -220,15 +222,18 @@ cat <<END >profiles/profile/package.use.force || exit 1
cat-two/pkg-two flag5
END
cat <<END > cat-one/pkg-one/pkg-one-1.ebuild || exit 1
-IUSE="flag1 flag2 flag3 flag4 flag5"
+EAPI=1
+IUSE="flag1 flag2 flag3 flag4 flag5 enabled +disabled enabled2 disabled2 enabled3 disabled3"
SLOT="0"
END
cat <<END > cat-one/pkg-one/pkg-one-2.ebuild || exit 1
-IUSE="flag1 flag2 flag3 flag4 flag5"
+EAPI=1
+IUSE="-flag1 flag2 flag3 flag4 +flag5 flag6"
SLOT="0"
END
cat <<END > cat-two/pkg-two/pkg-two-1.ebuild || exit 1
-IUSE="flag1 flag2 flag3 flag4 flag5"
+EAPI=1
+IUSE="flag1 flag2 flag3 flag4 flag5 +flag6"
SLOT="0"
END
cd ..