]> git.saurik.com Git - apt.git/blobdiff - test/libapt/configuration_test.cc
/dev/null is a special absolute path as it has no subdirectories
[apt.git] / test / libapt / configuration_test.cc
index 5b23d17fbefafd8a28010c3cad59539ffb5c4747..87d5699effffe4d06e7628a184b873b940ece442 100644 (file)
@@ -71,6 +71,33 @@ int main(int argc,const char *argv[]) {
        equals(Cnf.Find("APT2::Version", "33"), "33");
        equals(Cnf.FindI("APT2::Version", 33), 33);
 
+       equals(Cnf.FindFile("Dir::State"), "");
+       equals(Cnf.FindFile("Dir::Aptitude::State"), "");
+       Cnf.Set("Dir", "/srv/sid");
+       equals(Cnf.FindFile("Dir::State"), "");
+       Cnf.Set("Dir::State", "var/lib/apt");
+       Cnf.Set("Dir::Aptitude::State", "var/lib/aptitude");
+       equals(Cnf.FindFile("Dir::State"), "/srv/sid/var/lib/apt");
+       equals(Cnf.FindFile("Dir::Aptitude::State"), "/srv/sid/var/lib/aptitude");
+
+       Cnf.Set("RootDir", "/");
+       equals(Cnf.FindFile("Dir::State"), "/srv/sid/var/lib/apt");
+       equals(Cnf.FindFile("Dir::Aptitude::State"), "/srv/sid/var/lib/aptitude");
+       Cnf.Set("RootDir", "//./////.////");
+       equals(Cnf.FindFile("Dir::State"), "/srv/sid/var/lib/apt");
+       equals(Cnf.FindFile("Dir::Aptitude::State"), "/srv/sid/var/lib/aptitude");
+       Cnf.Set("RootDir", "/rootdir");
+       equals(Cnf.FindFile("Dir::State"), "/rootdir/srv/sid/var/lib/apt");
+       equals(Cnf.FindFile("Dir::Aptitude::State"), "/rootdir/srv/sid/var/lib/aptitude");
+       Cnf.Set("RootDir", "/rootdir/");
+       equals(Cnf.FindFile("Dir::State"), "/rootdir/srv/sid/var/lib/apt");
+       equals(Cnf.FindFile("Dir::Aptitude::State"), "/rootdir/srv/sid/var/lib/aptitude");
+
+       Cnf.Set("Dir::State", "/dev/null");
+       Cnf.Set("Dir::State::lists", "lists/");
+       equals(Cnf.FindDir("Dir::State"), "/rootdir/dev/null");
+       equals(Cnf.FindDir("Dir::State::lists"), "/rootdir/dev/null");
+
        //FIXME: Test for configuration file parsing;
        // currently only integration/ tests test them implicitly