summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-10-16 18:03:52 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2015-11-04 18:04:02 +0100
commitc3ded84c6f99bda4caf63c8662416ffb0189d31b (patch)
tree0b9c03d3ba4d44501091f13122e06d9d9cc6ad20 /test
parent73fe49f9b4748eddb5a2dad4f0abb51a8f63564c (diff)
add binary-specific options via Binary scope
Especially with apt now, it can be useful to set an option only for apt and not for apt-get. Using a binary-specific subtree which is merged into the root seems like a simple enough trick to achieve this.
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-apt-showlist-orgroup-in-recommends42
-rw-r--r--test/libapt/configuration_test.cc17
2 files changed, 59 insertions, 0 deletions
diff --git a/test/integration/test-apt-showlist-orgroup-in-recommends b/test/integration/test-apt-showlist-orgroup-in-recommends
index 929f7feb9..fea54f1ce 100755
--- a/test/integration/test-apt-showlist-orgroup-in-recommends
+++ b/test/integration/test-apt-showlist-orgroup-in-recommends
@@ -39,6 +39,17 @@ The following NEW packages will be installed:
simple
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Inst simple (1 unstable [all])
+Conf simple (1 unstable [all])' aptget install simple -s --install-recommends --install-suggests
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+Suggested packages:
+ ccc
+Recommended packages:
+ bbb
+The following NEW packages will be installed:
+ simple
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst simple (1 unstable [all])
Conf simple (1 unstable [all])' aptget install simple -s --no-install-recommends
testsuccessequal 'Reading package lists...
Building dependency tree...
@@ -156,3 +167,34 @@ The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Inst versionedor (1 unstable [all])
Conf versionedor (1 unstable [all])' aptget install versionedor -s --no-install-recommends
+
+SHOWSUGGEST='Reading package lists...
+Building dependency tree...
+Suggested packages:
+ zzz
+Recommended packages:
+ xxx
+The following NEW packages will be installed:
+ orgroup4
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst orgroup4 (1 unstable [all])
+Conf orgroup4 (1 unstable [all])'
+INSTSUGGEST='Reading package lists...
+Building dependency tree...
+The following additional packages will be installed:
+ zzz
+Recommended packages:
+ xxx
+The following NEW packages will be installed:
+ orgroup4 zzz
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst orgroup4 (1 unstable [all])
+Inst zzz (1:1 unstable [all])
+Conf orgroup4 (1 unstable [all])
+Conf zzz (1:1 unstable [all])'
+testsuccessequal "$SHOWSUGGEST" aptget install orgroup4 -s
+testsuccessequal "$INSTSUGGEST" aptget install orgroup4 --install-suggests -s
+echo 'Binary::apt-get::APT::Install-Suggests "true";' > rootdir/etc/apt/apt.conf.d/99binaryspecific.conf
+testsuccessequal "$INSTSUGGEST" aptget install orgroup4 -s
+testsuccessequal "$SHOWSUGGEST" apt install orgroup4 -s
+testsuccessequal "$SHOWSUGGEST" aptget install orgroup4 -s --no-install-suggests
diff --git a/test/libapt/configuration_test.cc b/test/libapt/configuration_test.cc
index 647d8a4af..6300b5256 100644
--- a/test/libapt/configuration_test.cc
+++ b/test/libapt/configuration_test.cc
@@ -144,3 +144,20 @@ TEST(ConfigurationTest,Vector)
EXPECT_EQ("abel", vec[0]);
EXPECT_EQ("bravo", vec[1]);
}
+TEST(ConfigurationTest,Merge)
+{
+ Configuration Cnf;
+ Cnf.Set("Binary::apt::option::foo", "bar");
+ Cnf.Set("option::foo", "foo");
+
+ Cnf.MoveSubTree("Binary::apt", "Binary::apt2");
+ EXPECT_FALSE(Cnf.Exists("Binary::apt::option"));
+ EXPECT_TRUE(Cnf.Exists("option"));
+ EXPECT_EQ("foo", Cnf.Find("option::foo"));
+ EXPECT_EQ("bar", Cnf.Find("Binary::apt2::option::foo"));
+
+ Cnf.MoveSubTree("Binary::apt2", NULL);
+ EXPECT_FALSE(Cnf.Exists("Binary::apt2::option"));
+ EXPECT_TRUE(Cnf.Exists("option"));
+ EXPECT_EQ("bar", Cnf.Find("option::foo"));
+}