summaryrefslogtreecommitdiff
path: root/test/libapt/configuration_test.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-04-01 13:57:22 +0200
committerMichael Vogt <mvo@debian.org>2014-04-01 13:57:22 +0200
commit8a1c9010137a8c49d9808f2db34b9ee277138986 (patch)
tree5ec5c0103cb896407d8c9542fac0ec8ab3313602 /test/libapt/configuration_test.cc
parentfa55ccaa85ca8f85251300f5c5f574edc0c3ca71 (diff)
parent417e83d0d79637266e04c98189c62ce85bcdf737 (diff)
Merge branch 'debian/sid' into ubuntu/master
Conflicts: apt-pkg/deb/dpkgpm.cc debian/apt.auto-removal.sh debian/changelog vendor/debian/sources.list.in
Diffstat (limited to 'test/libapt/configuration_test.cc')
-rw-r--r--test/libapt/configuration_test.cc38
1 files changed, 34 insertions, 4 deletions
diff --git a/test/libapt/configuration_test.cc b/test/libapt/configuration_test.cc
index 2c974ee0a..c9235500c 100644
--- a/test/libapt/configuration_test.cc
+++ b/test/libapt/configuration_test.cc
@@ -1,3 +1,5 @@
+#include <config.h>
+
#include <apt-pkg/configuration.h>
#include <string>
@@ -5,7 +7,7 @@
#include "assert.h"
-int main(int argc,const char *argv[]) {
+int main() {
Configuration Cnf;
std::vector<std::string> fds;
@@ -98,9 +100,37 @@ int main(int argc,const char *argv[]) {
equals(Cnf.FindDir("Dir::State"), "/rootdir/dev/null");
equals(Cnf.FindDir("Dir::State::lists"), "/rootdir/dev/null");
- Cnf.Set("Moo::Bar", "1");
- Cnf.Clear();
- equals(Cnf.Find("Moo::Bar"), "");
+ Cnf.Set("Moo::Bar", "1");
+ Cnf.Clear();
+ equals(Cnf.Find("Moo::Bar"), "");
+
+ std::vector<std::string> vec = Cnf.FindVector("Test::Vector", "");
+ equals(vec.size(), 0);
+ vec = Cnf.FindVector("Test::Vector", "foo");
+ equals(vec.size(), 1);
+ equals(vec[0], "foo");
+ vec = Cnf.FindVector("Test::Vector", "foo,bar");
+ equals(vec.size(), 2);
+ equals(vec[0], "foo");
+ equals(vec[1], "bar");
+ Cnf.Set("Test::Vector::", "baz");
+ Cnf.Set("Test::Vector::", "bob");
+ Cnf.Set("Test::Vector::", "dob");
+ vec = Cnf.FindVector("Test::Vector");
+ equals(vec.size(), 3);
+ equals(vec[0], "baz");
+ equals(vec[1], "bob");
+ equals(vec[2], "dob");
+ vec = Cnf.FindVector("Test::Vector", "foo,bar");
+ equals(vec.size(), 3);
+ equals(vec[0], "baz");
+ equals(vec[1], "bob");
+ equals(vec[2], "dob");
+ Cnf.Set("Test::Vector", "abel,bravo");
+ vec = Cnf.FindVector("Test::Vector", "foo,bar");
+ equals(vec.size(), 2);
+ equals(vec[0], "abel");
+ equals(vec[1], "bravo");
//FIXME: Test for configuration file parsing;
// currently only integration/ tests test them implicitly