diff options
author | David Kalnischkies <david@kalnischkies.de> | 2015-10-16 18:03:52 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2015-11-04 18:04:02 +0100 |
commit | c3ded84c6f99bda4caf63c8662416ffb0189d31b (patch) | |
tree | 0b9c03d3ba4d44501091f13122e06d9d9cc6ad20 /test/libapt | |
parent | 73fe49f9b4748eddb5a2dad4f0abb51a8f63564c (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/libapt')
-rw-r--r-- | test/libapt/configuration_test.cc | 17 |
1 files changed, 17 insertions, 0 deletions
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")); +} |