test-catalog.c revision 9d85882aa8ef1c54171419703f48d59d9df1b75c
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2012 Lennart Poettering
Copyright 2013 Zbigniew Jędrzejewski-Szmek
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <errno.h>
#include <fcntl.h>
#include <locale.h>
#include <unistd.h>
#include "sd-messages.h"
#include "alloc-util.h"
#include "catalog.h"
#include "fd-util.h"
#include "fileio.h"
#include "log.h"
#include "macro.h"
#include "string-util.h"
#include "util.h"
static const char *catalog_dirs[] = {
NULL,
};
static const char *no_catalog_dirs[] = {
};
int r;
char name[] = "/tmp/test-catalog.XXXXXX";
_cleanup_close_ int fd;
Hashmap *h;
if (size < 0)
r = catalog_import_file(h, name);
return h;
}
static void test_catalog_import_invalid(void) {
assert_se(hashmap_isempty(h));
}
static void test_catalog_import_badid(void) {
const char *input =
"-- 0027229ca0644181a76c4e92458afaff dededededededededededededededede\n" \
"Subject: message\n" \
"\n" \
"payload\n";
}
static void test_catalog_import_one(void) {
char *payload;
Iterator j;
const char *input =
"-- 0027229ca0644181a76c4e92458afaff dededededededededededededededed\n" \
"Subject: message\n" \
"\n" \
"payload\n";
const char *expect =
"Subject: message\n" \
"\n" \
"payload\n";
HASHMAP_FOREACH(payload, h, j) {
}
}
static void test_catalog_update(void) {
static char name[] = "/tmp/test-catalog.XXXXXX";
int r;
assert_se(r >= 0);
/* Test what happens if there are no files. */
assert_se(r >= 0);
/* Test what happens if there are no files in the directory. */
assert_se(r >= 0);
/* Make sure that we at least have some files loaded or the
catalog_list below will fail. */
assert_se(r >= 0);
}
static void test_catalog_file_lang(void) {
}
int r;
log_open();
assert_se(r >= 0);
assert_se(r >= 0);
if (database)
return 0;
}