]> git.saurik.com Git - apt.git/blobdiff - test/libapt/configuration_test.cc
* lp:~mvo/apt/config-clear:
[apt.git] / test / libapt / configuration_test.cc
index 5ec48834a74400520158771d1a3c0af53ec89b34..2c974ee0a9b6271ea2128320bd1a95285ee5ccf6 100644 (file)
@@ -80,8 +80,26 @@ int main(int argc,const char *argv[]) {
        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");
+
         Cnf.Set("Moo::Bar", "1");
-        Cnf.ClearAll();
+        Cnf.Clear();
         equals(Cnf.Find("Moo::Bar"), "");
 
        //FIXME: Test for configuration file parsing;