]> git.notmuchmail.org Git - notmuch/blob - test/message-id-parse.c
test: add known broken test for error handling on closed database
[notmuch] / test / message-id-parse.c
1 #include <stdio.h>
2 #include <talloc.h>
3 #include "notmuch-private.h"
4
5 int
6 main (unused (int argc), unused (char **argv))
7 {
8     char *line = NULL;
9     size_t len = 0;
10     ssize_t nread;
11     void *local = talloc_new (NULL);
12
13     while ((nread = getline (&line, &len, stdin)) != -1) {
14         int last = strlen (line) - 1;
15         if (line[last] == '\n')
16             line[last] = '\0';
17
18         char *mid = _notmuch_message_id_parse_strict (local, line);
19         if (mid)
20             printf ("GOOD: %s\n", mid);
21         else
22             printf ("BAD: %s\n", line);
23     }
24
25     talloc_free (local);
26 }