summaryrefslogtreecommitdiff
path: root/test/libapt
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-10-05 22:45:22 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-10-05 22:45:22 +0200
commit7cb28948317e0d326c8663ec3c9ce995d5bf65e8 (patch)
tree42df84085ed6eaa11a035ae731a6ee545e2687ea /test/libapt
parent0fffbc8ce4cb6357f59db63db5571f46a668a66b (diff)
* apt-pkg/deb/debmetaindex.cc:
- none is a separator, not a language: no need for Index (Closes: #624218) * apt-pkg/aptconfiguration.cc: - do not builtin languages only if none is forced (Closes: #643787)
Diffstat (limited to 'test/libapt')
-rw-r--r--test/libapt/assert.h15
-rw-r--r--test/libapt/getlanguages_test.cc12
-rwxr-xr-xtest/libapt/run-tests3
3 files changed, 26 insertions, 4 deletions
diff --git a/test/libapt/assert.h b/test/libapt/assert.h
index fae9b6c64..ce5accc1c 100644
--- a/test/libapt/assert.h
+++ b/test/libapt/assert.h
@@ -54,6 +54,21 @@ void assertEqualsOr2(int const &expect1, int const &expect2, unsigned int const
}
+#define equalsOr3(w,x,y,z) assertEqualsOr3(x, y, z, w, __LINE__)
+
+template < typename X, typename Y >
+void OutputAssertEqualOr3(X expect1, X expect2, X expect3, char const* compare, Y get, unsigned long const &line) {
+ std::cerr << "Test FAILED: »" << expect1 << "« or »" << expect2 << "« or »" << expect3 << "« " << compare << " »" << get << "« at line " << line << std::endl;
+}
+
+template < typename X, typename Y >
+void assertEqualsOr3(X expect1, X expect2, X expect3, Y get, unsigned long const &line) {
+ if (expect1 == get || expect2 == get || expect3 == get)
+ return;
+ OutputAssertEqualOr3(expect1, expect2, expect3, "==", get, line);
+}
+
+
// simple helper to quickly output a vectors
template < typename X >
void dumpVector(X vec) {
diff --git a/test/libapt/getlanguages_test.cc b/test/libapt/getlanguages_test.cc
index f6aa7a697..a1c801ea2 100644
--- a/test/libapt/getlanguages_test.cc
+++ b/test/libapt/getlanguages_test.cc
@@ -126,13 +126,19 @@ int main(int argc,char *argv[])
_config->Set("Dir::State::lists", argv[1]);
vec = APT::Configuration::getLanguages(true, false, env);
- equals(vec.size(), 6);
+ equals(vec.size(), 7);
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");
+ equalsOr3(vec[4], "pt", "tr", "ast_DE");
+ equalsOr3(vec[5], "tr", "pt", "ast_DE");
+ equalsOr3(vec[6], "tr", "pt", "ast_DE");
+
+ _config->Set("Acquire::Languages", "none");
+ vec = APT::Configuration::getLanguages(true, false, env);
+ equals(vec.size(), 0);
+ _config->Set("Acquire::Languages", "");
_config->Set("Dir::State::lists", "/non-existing-dir");
_config->Set("Acquire::Languages::1", "none");
diff --git a/test/libapt/run-tests b/test/libapt/run-tests
index 8cb2e049c..ada2dc38b 100755
--- a/test/libapt/run-tests
+++ b/test/libapt/run-tests
@@ -64,7 +64,8 @@ do
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"
+ "${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"
elif [ $name = "HashSums${EXT}" ]; then
TMP="$(mktemp)"
dmesg > $TMP