summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-02-18 00:35:25 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-02-18 00:35:25 +0100
commit3f2d77b5e02c5749a78ad9852c01cfad4ce0fda1 (patch)
tree4cb3ba9659d42f729ffee310364ad05a0e94f561 /test
parentf0f2f956957af36389790fd47899a1f65302b21c (diff)
downloadapt-3f2d77b5e02c5749a78ad9852c01cfad4ce0fda1.tar.gz
* aptconfiguration.cc:
- include all existing Translation files in the Cache (Closes: 564137) Previously if APT was executed with a different LC_* all these invocations needed to rebuild the Cache as too many files were included or missing: Now the lists-directory is checked for Translation-files and all these will be included in getLanguages() regardless of the environment setting (after a "none" so APT will not use them for displaying information).
Diffstat (limited to 'test')
-rw-r--r--test/libapt/getlanguages_test.cc22
-rwxr-xr-xtest/libapt/run-tests.sh7
2 files changed, 27 insertions, 2 deletions
diff --git a/test/libapt/getlanguages_test.cc b/test/libapt/getlanguages_test.cc
index fb7afb4ef..0db190b50 100644
--- a/test/libapt/getlanguages_test.cc
+++ b/test/libapt/getlanguages_test.cc
@@ -16,9 +16,15 @@ void dumpVector(std::vector<std::string> vec) {
int main(int argc,char *argv[])
{
+ if (argc != 2) {
+ std::cout << "One parameter expected - given " << argc << std::endl;
+ return 100;
+ }
+
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");
@@ -87,6 +93,16 @@ int main(int argc,char *argv[])
equals(vec[0], "de");
equals(vec[1], "en");
+ _config->Set("Dir::State::lists", argv[1]);
+ vec = APT::Configuration::getLanguages(true, false, env);
+ equals(vec.size(), 5);
+ equals(vec[0], "de");
+ equals(vec[1], "en");
+ equals(vec[2], "none");
+ equals(vec[3], "pt");
+ equals(vec[4], "tr");
+
+ _config->Set("Dir::State::lists", "/non-existing-dir");
_config->Set("Acquire::Languages::1", "none");
env[0] = "de_DE.UTF-8";
vec = APT::Configuration::getLanguages(false, false, env);
@@ -113,12 +129,14 @@ int main(int argc,char *argv[])
_config->Set("APT::Acquire::Translation", "ast_DE");
env[0] = "de_DE.UTF-8";
vec = APT::Configuration::getLanguages(true, false, env);
- equals(vec.size(), 1);
+ equals(vec.size(), 2);
equals(vec[0], "ast_DE");
+ equals(vec[1], "en");
_config->Set("APT::Acquire::Translation", "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], "en");
return 0;
}
diff --git a/test/libapt/run-tests.sh b/test/libapt/run-tests.sh
index 1fcfb6861..f9df1af5f 100755
--- a/test/libapt/run-tests.sh
+++ b/test/libapt/run-tests.sh
@@ -39,6 +39,13 @@ do
"${tmppath}/01invalĂ­d"
ln -s "${tmppath}/anormalfile" "${tmppath}/linkedfile.list"
ln -s "${tmppath}/non-existing-file" "${tmppath}/brokenlink.list"
+ elif [ $name = "getLanguages${EXT}" ]; then
+ echo "Prepare Testarea for \033[1;35m$name\033[0m ..."
+ tmppath=$(mktemp -d)
+ touch "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-tr" \
+ "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-pt" \
+ "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-se~" \
+ "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-st.bak"
fi
echo -n "Testing with \033[1;35m${name}\033[0m ... "