summaryrefslogtreecommitdiff
path: root/src/journal/test-catalog.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-12-15 21:07:47 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-12-15 23:36:36 -0500
commit4b8268f843b0da1cfe1995d93a0b1f95faccc454 (patch)
treef7ab0a390cefa0d5fe94e585fbededa6d36c10db /src/journal/test-catalog.c
parent2cfbd749af308bdbe56edcfed7f3eea0fc2b93d2 (diff)
catalog: fix language detection
Detection would fail if language was not specified in the filename but a dot appeared somewhere higher in the path.
Diffstat (limited to 'src/journal/test-catalog.c')
-rw-r--r--src/journal/test-catalog.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/journal/test-catalog.c b/src/journal/test-catalog.c
index 863b9f4b51..ffe180265b 100644
--- a/src/journal/test-catalog.c
+++ b/src/journal/test-catalog.c
@@ -121,7 +121,7 @@ static void test_catalog_update(void) {
}
static void test_catalog_file_lang(void) {
- _cleanup_free_ char *lang = NULL, *lang2 = NULL, *lang3 = NULL;
+ _cleanup_free_ char *lang = NULL, *lang2 = NULL, *lang3 = NULL, *lang4 = NULL;
assert_se(catalog_file_lang("systemd.de_DE.catalog", &lang) == 1);
assert_se(streq(lang, "de_DE"));
@@ -140,6 +140,12 @@ static void test_catalog_file_lang(void) {
assert_se(catalog_file_lang("systemd.0123456789012345678901234567890.catalog", &lang3) == 1);
assert_se(streq(lang3, "0123456789012345678901234567890"));
+
+ assert_se(catalog_file_lang("/x/y/systemd.catalog", &lang4) == 0);
+ assert_se(lang4 == NULL);
+
+ assert_se(catalog_file_lang("/x/y/systemd.ru_RU.catalog", &lang4) == 1);
+ assert_se(streq(lang4, "ru_RU"));
}
int main(int argc, char *argv[]) {
@@ -150,6 +156,8 @@ int main(int argc, char *argv[]) {
log_set_max_level(LOG_DEBUG);
+ test_catalog_file_lang();
+
test_catalog_importing();
test_catalog_update();
@@ -166,7 +174,5 @@ int main(int argc, char *argv[]) {
if (database)
unlink(database);
- test_catalog_file_lang();
-
return 0;
}