summaryrefslogtreecommitdiff
path: root/test/libapt/getlanguages_test.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-02-14 23:34:56 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-02-14 23:34:56 +0100
commit83742b3cf4b541fd61533dfecdc97e0e4502a7a4 (patch)
tree4b6be75f1471e6b406989dcc102754c996bad50d /test/libapt/getlanguages_test.cc
parentee60a63480f7d1a963d7ef2a8e399d0f9b651d71 (diff)
Add support for the LANGUAGE environment variable
Diffstat (limited to 'test/libapt/getlanguages_test.cc')
-rw-r--r--test/libapt/getlanguages_test.cc61
1 files changed, 47 insertions, 14 deletions
diff --git a/test/libapt/getlanguages_test.cc b/test/libapt/getlanguages_test.cc
index fd3c8269f..fb7afb4ef 100644
--- a/test/libapt/getlanguages_test.cc
+++ b/test/libapt/getlanguages_test.cc
@@ -16,75 +16,108 @@ void dumpVector(std::vector<std::string> vec) {
int main(int argc,char *argv[])
{
- std::vector<std::string> vec = APT::Configuration::getLanguages(false, false, "de_DE.UTF-8");
+ char const* env[2];
+ env[0] = "de_DE.UTF-8";
+ env[1] = "";
+ std::vector<std::string> vec = APT::Configuration::getLanguages(false, false, env);
equals(vec.size(), 2);
equals(vec[0], "de");
equals(vec[1], "en");
// Special: Check if the cache is actually in use
- vec = APT::Configuration::getLanguages(false, true, "en_GB.UTF-8");
+ env[0] = "en_GB.UTF-8";
+ vec = APT::Configuration::getLanguages(false, true, env);
equals(vec.size(), 2);
equals(vec[0], "de");
equals(vec[1], "en");
- vec = APT::Configuration::getLanguages(false, false, "en_GB.UTF-8");
+ env[0] = "en_GB.UTF-8";
+ vec = APT::Configuration::getLanguages(false, false, env);
equals(vec.size(), 2);
equals(vec[0], "en_GB");
equals(vec[1], "en");
- vec = APT::Configuration::getLanguages(false, false, "pt_PR.UTF-8");
+ env[0] = "tr_DE@euro";
+ vec = APT::Configuration::getLanguages(false, false, env);
+ equals(vec.size(), 2);
+ equals(vec[0], "tr");
+ equals(vec[1], "en");
+
+ env[0] = "de_NO";
+ env[1] = "se_NO:en_GB:nb_NO:nb:no_NO:no:nn_NO:nn:da:sv:en";
+ vec = APT::Configuration::getLanguages(false, false, env);
+ equals(vec.size(), 5);
+ equals(vec[0], "de");
+ equals(vec[1], "en_GB");
+ equals(vec[2], "nb");
+ equals(vec[3], "no");
+ equals(vec[4], "en");
+
+ env[0] = "pt_PR.UTF-8";
+ env[1] = "";
+ vec = APT::Configuration::getLanguages(false, false, env);
equals(vec.size(), 3);
equals(vec[0], "pt_PR");
equals(vec[1], "pt");
equals(vec[2], "en");
- vec = APT::Configuration::getLanguages(false, false, "ast_DE.UTF-8"); // bogus, but syntactical correct
+ env[0] = "ast_DE.UTF-8";
+ vec = APT::Configuration::getLanguages(false, false, env); // bogus, but syntactical correct
equals(vec.size(), 2);
equals(vec[0], "ast");
equals(vec[1], "en");
- vec = APT::Configuration::getLanguages(false, false, "C");
+ env[0] = "C";
+ vec = APT::Configuration::getLanguages(false, false, env);
equals(vec.size(), 1);
equals(vec[0], "en");
_config->Set("Acquire::Languages::1", "environment");
_config->Set("Acquire::Languages::2", "en");
- vec = APT::Configuration::getLanguages(false, false, "de_DE.UTF-8");
+ env[0] = "de_DE.UTF-8";
+ vec = APT::Configuration::getLanguages(false, false, env);
equals(vec.size(), 2);
equals(vec[0], "de");
equals(vec[1], "en");
_config->Set("Acquire::Languages::3", "de");
- vec = APT::Configuration::getLanguages(false, false, "de_DE.UTF-8");
+ env[0] = "de_DE.UTF-8";
+ vec = APT::Configuration::getLanguages(false, false, env);
equals(vec.size(), 2);
equals(vec[0], "de");
equals(vec[1], "en");
_config->Set("Acquire::Languages::1", "none");
- vec = APT::Configuration::getLanguages(false, false, "de_DE.UTF-8");
+ env[0] = "de_DE.UTF-8";
+ vec = APT::Configuration::getLanguages(false, false, env);
equals(vec.size(), 0);
- vec = APT::Configuration::getLanguages(true, false, "de_DE.UTF-8");
+ env[0] = "de_DE.UTF-8";
+ vec = APT::Configuration::getLanguages(true, false, env);
equals(vec[0], "en");
equals(vec[1], "de");
_config->Set("Acquire::Languages::1", "fr");
_config->Set("Acquire::Languages", "de_DE");
- vec = APT::Configuration::getLanguages(false, false, "de_DE.UTF-8");
+ env[0] = "de_DE.UTF-8";
+ vec = APT::Configuration::getLanguages(false, false, env);
equals(vec.size(), 1);
equals(vec[0], "de_DE");
_config->Set("Acquire::Languages", "none");
- vec = APT::Configuration::getLanguages(true, false, "de_DE.UTF-8");
+ env[0] = "de_DE.UTF-8";
+ vec = APT::Configuration::getLanguages(true, false, env);
equals(vec.size(), 0);
_config->Set("Acquire::Languages", "");
//FIXME: Remove support for this deprecated setting
_config->Set("APT::Acquire::Translation", "ast_DE");
- vec = APT::Configuration::getLanguages(true, false, "de_DE.UTF-8");
+ env[0] = "de_DE.UTF-8";
+ vec = APT::Configuration::getLanguages(true, false, env);
equals(vec.size(), 1);
equals(vec[0], "ast_DE");
_config->Set("APT::Acquire::Translation", "none");
- vec = APT::Configuration::getLanguages(true, false, "de_DE.UTF-8");
+ env[0] = "de_DE.UTF-8";
+ vec = APT::Configuration::getLanguages(true, false, env);
equals(vec.size(), 0);
return 0;