failing test noentry; good

This commit is contained in:
2023-02-04 19:06:43 -08:00
parent 1a2fbccf23
commit 745e7c3167
6 changed files with 56 additions and 11 deletions

View File

@@ -11,6 +11,27 @@ int main(void) {
struct journal j = journal();
struct sources s = sources(&j);
if(errno) goto catch;
const union line64 agenda = {{4,{{20,04,1996}}}},
before = {{1,{{1,1,1900}}}},
noentry = {{3,{{1,6,1995}}}};
const struct source *source;
source = source_lookup(&s, agenda);
printf("agenda: <%.*s>\n",
(int)(source->name.b - source->name.a), source->name.a);
assert(pair_is_string(source->name, "1995agenda"));
source = source_lookup(&s, before);
printf("before: <%.*s>\n",
(int)(source->name.b - source->name.a), source->name.a);
assert(pair_is_string(source->name, 0));
source = source_lookup(&s, noentry);
printf("noentry: <%.*s>\n",
(int)(source->name.b - source->name.a), source->name.a);
assert(pair_is_string(source->name, 0));
goto finally;
catch:
success = EXIT_FAILURE, perror("source");