]> git.saurik.com Git - apt.git/blobdiff - test/libapt/getlanguages_test.cc
merge patch from Daniel Hartwig to Show a error message if {,dist-}upgrade is used...
[apt.git] / test / libapt / getlanguages_test.cc
index 3d63e0e7475f726fbbab897ec0260a7bf6191cef..cef89bde6583d574f6f55fc0826f879348b87cfb 100644 (file)
@@ -7,13 +7,6 @@
 
 #include <iostream>
 
 
 #include <iostream>
 
-// simple helper to quickly output a vector of strings
-void dumpVector(std::vector<std::string> vec) {
-       for (std::vector<std::string>::const_iterator v = vec.begin();
-            v != vec.end(); v++)
-               std::cout << *v << std::endl;
-}
-
 int main(int argc,char *argv[])
 {
        if (argc != 2) {
 int main(int argc,char *argv[])
 {
        if (argc != 2) {
@@ -133,13 +126,27 @@ int main(int argc,char *argv[])
 
        _config->Set("Dir::State::lists", argv[1]);
        vec = APT::Configuration::getLanguages(true, false, env);
 
        _config->Set("Dir::State::lists", argv[1]);
        vec = APT::Configuration::getLanguages(true, false, env);
-       equals(vec.size(), 6);
+       equals(vec.size(), 8);
        equals(vec[0], "de_DE");
        equals(vec[1], "de");
        equals(vec[2], "en");
        equals(vec[3], "none");
        equals(vec[0], "de_DE");
        equals(vec[1], "de");
        equals(vec[2], "en");
        equals(vec[3], "none");
-       equalsOr2(vec[4], "pt", "tr");
-       equalsOr2(vec[5], "tr", "pt");
+       equalsOr4(vec[4], "pt", "tr", "ast_DE", "tlh_DE");
+       equalsOr4(vec[5], "tr", "pt", "ast_DE", "tlh_DE");
+       equalsOr4(vec[6], "tr", "pt", "ast_DE", "tlh_DE");
+       equalsOr4(vec[7], "tr", "pt", "ast_DE", "tlh_DE");
+       equalsNot(vec[4], vec[5]);
+       equalsNot(vec[4], vec[6]);
+       equalsNot(vec[4], vec[7]);
+       equalsNot(vec[5], vec[6]);
+       equalsNot(vec[5], vec[7]);
+       equalsNot(vec[6], vec[7]);
+
+       _config->Set("Acquire::Languages", "none");
+       vec = APT::Configuration::getLanguages(true, false, env);
+       equals(vec.size(), 1);
+       equals(vec[0], "none");
+       _config->Set("Acquire::Languages", "");
 
        _config->Set("Dir::State::lists", "/non-existing-dir");
        _config->Set("Acquire::Languages::1", "none");
 
        _config->Set("Dir::State::lists", "/non-existing-dir");
        _config->Set("Acquire::Languages::1", "none");
@@ -162,7 +169,8 @@ int main(int argc,char *argv[])
        _config->Set("Acquire::Languages", "none");
        env[0] = "de_DE.UTF-8";
        vec = APT::Configuration::getLanguages(true, false, env);
        _config->Set("Acquire::Languages", "none");
        env[0] = "de_DE.UTF-8";
        vec = APT::Configuration::getLanguages(true, false, env);
-       equals(vec.size(), 0);
+       equals(vec.size(), 1);
+       equals(vec[0], "none");
 
        _config->Set("Acquire::Languages", "");
        //FIXME: Remove support for this deprecated setting
 
        _config->Set("Acquire::Languages", "");
        //FIXME: Remove support for this deprecated setting