add unit test for old style journal files
This commit is contained in:
parent
cf38de5355
commit
8e07c4bf66
@ -271,6 +271,8 @@ static EDErrorCode ed_journal_file_load(EDJournalFile *self,
|
||||
p->entries = g_list_append(p->entries, entry);
|
||||
}
|
||||
|
||||
ret = ed_error_success;
|
||||
|
||||
done:
|
||||
|
||||
g_clear_object(&file);
|
||||
|
0
lib/tests/Journal.230418061507.01.log
Normal file
0
lib/tests/Journal.230418061507.01.log
Normal file
@ -23,6 +23,23 @@ static void test_new_filename(void **state)
|
||||
g_clear_object(&file);
|
||||
}
|
||||
|
||||
static void test_old_filename(void **state)
|
||||
{
|
||||
char const *filename = "Journal.230418061507.01.log";
|
||||
|
||||
EDJournalFile *file = ed_journal_file_new();
|
||||
EDErrorCode ret = 0;
|
||||
GError *error = NULL;
|
||||
|
||||
assert_non_null(file);
|
||||
|
||||
ret = ed_journal_file_open(file, filename, &error);
|
||||
assert_int_equal(ret, ed_error_success);
|
||||
assert_null(error);
|
||||
|
||||
g_clear_object(&file);
|
||||
}
|
||||
|
||||
static void test_valid_load(void **state)
|
||||
{
|
||||
char const *filename = "Journal.2023-04-18T061507.01.log";
|
||||
@ -58,6 +75,7 @@ int main(int ac, char **av)
|
||||
{
|
||||
static const struct CMUnitTest tests[] = {
|
||||
cmocka_unit_test(test_new_filename),
|
||||
cmocka_unit_test(test_old_filename),
|
||||
cmocka_unit_test(test_valid_load),
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user