summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2012-05-20 18:58:37 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2012-05-20 18:58:37 +0200
commit527df5a20dbe8ce98fcbf1ffe28bb37ff2257a97 (patch)
tree47e26520c6a88c7a3a77a4e00570964afa87e2f5
parent75f37d7d27c2579ddb88f852087a54934cb00c8b (diff)
* apt-pkg/aptconfiguration.cc:
- longcode Translation files are saved with encoded underscore, so make sure to pick these files up as well for Acquire::Languages
-rw-r--r--apt-pkg/aptconfiguration.cc2
-rw-r--r--debian/changelog3
-rw-r--r--test/libapt/assert.h21
-rw-r--r--test/libapt/getlanguages_test.cc15
-rwxr-xr-xtest/libapt/run-tests3
5 files changed, 38 insertions, 6 deletions
diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc
index 0fd470ed5..d763546f8 100644
--- a/apt-pkg/aptconfiguration.cc
+++ b/apt-pkg/aptconfiguration.cc
@@ -144,7 +144,7 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All,
if (D != 0) {
builtin.push_back("none");
for (struct dirent *Ent = readdir(D); Ent != 0; Ent = readdir(D)) {
- string const name = Ent->d_name;
+ string const name = SubstVar(Ent->d_name, "%5f", "_");
size_t const foundDash = name.rfind("-");
size_t const foundUnderscore = name.rfind("_", foundDash);
if (foundDash == string::npos || foundUnderscore == string::npos ||
diff --git a/debian/changelog b/debian/changelog
index c4bf881ca..5d4f8720c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -38,6 +38,9 @@ apt (0.9.4) UNRELEASED; urgency=low
* doc/*.xml:
- add a few translator notes and reword some paragraphs to ensure that
translators and users alike can better understand them (Closes: #669409)
+ * apt-pkg/aptconfiguration.cc:
+ - longcode Translation files are saved with encoded underscore,
+ so make sure to pick these files up as well for Acquire::Languages
[ Raphael Geissert ]
* apt-pkg/acquire*.cc:
diff --git a/test/libapt/assert.h b/test/libapt/assert.h
index a07be4b57..fdf6740c6 100644
--- a/test/libapt/assert.h
+++ b/test/libapt/assert.h
@@ -1,6 +1,7 @@
#include <iostream>
#define equals(x,y) assertEquals(y, x, __LINE__)
+#define equalsNot(x,y) assertEqualsNot(y, x, __LINE__)
template < typename X, typename Y >
void OutputAssertEqual(X expect, char const* compare, Y get, unsigned long const &line) {
@@ -14,6 +15,13 @@ void assertEquals(X expect, Y get, unsigned long const &line) {
OutputAssertEqual(expect, "==", get, line);
}
+template < typename X, typename Y >
+void assertEqualsNot(X expect, Y get, unsigned long const &line) {
+ if (expect != get)
+ return;
+ OutputAssertEqual(expect, "!=", get, line);
+}
+
void assertEquals(unsigned int const &expect, int const &get, unsigned long const &line) {
if (get < 0)
OutputAssertEqual(expect, "==", get, line);
@@ -80,6 +88,19 @@ void assertEqualsOr3(X expect1, X expect2, X expect3, Y get, unsigned long const
OutputAssertEqualOr3(expect1, expect2, expect3, "==", get, line);
}
+#define equalsOr4(v,w,x,y,z) assertEqualsOr4(w, x, y, z, v, __LINE__)
+
+template < typename X, typename Y >
+void OutputAssertEqualOr4(X expect1, X expect2, X expect3, X expect4, char const* compare, Y get, unsigned long const &line) {
+ std::cerr << "Test FAILED: »" << expect1 << "« or »" << expect2 << "« or »" << expect3 << "« or »" << expect4 << "« " << compare << " »" << get << "« at line " << line << std::endl;
+}
+
+template < typename X, typename Y >
+void assertEqualsOr4(X expect1, X expect2, X expect3, X expect4, Y get, unsigned long const &line) {
+ if (expect1 == get || expect2 == get || expect3 == get || expect4 == get)
+ return;
+ OutputAssertEqualOr4(expect1, expect2, expect3, expect4, "==", get, line);
+}
// simple helper to quickly output a vectors
template < typename X >
diff --git a/test/libapt/getlanguages_test.cc b/test/libapt/getlanguages_test.cc
index a1c801ea2..274cf4aa4 100644
--- a/test/libapt/getlanguages_test.cc
+++ b/test/libapt/getlanguages_test.cc
@@ -126,14 +126,21 @@ int main(int argc,char *argv[])
_config->Set("Dir::State::lists", argv[1]);
vec = APT::Configuration::getLanguages(true, false, env);
- equals(vec.size(), 7);
+ equals(vec.size(), 8);
equals(vec[0], "de_DE");
equals(vec[1], "de");
equals(vec[2], "en");
equals(vec[3], "none");
- equalsOr3(vec[4], "pt", "tr", "ast_DE");
- equalsOr3(vec[5], "tr", "pt", "ast_DE");
- equalsOr3(vec[6], "tr", "pt", "ast_DE");
+ 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);
diff --git a/test/libapt/run-tests b/test/libapt/run-tests
index 4ea9a916d..45a3157f7 100755
--- a/test/libapt/run-tests
+++ b/test/libapt/run-tests
@@ -65,7 +65,8 @@ do
"${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" \
- "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-ast_DE"
+ "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-ast_DE" \
+ "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-tlh%5fDE"
elif [ $name = "HashSums${EXT}" ]; then
TMP="$(readlink -f "./${0}")"
echo -n "Testing with ${NAME} "