-cat <<EOF > c_head2
-#include <stdio.h>
-#include <notmuch.h>
-#include <notmuch-test.h>
-int main (int argc, char** argv)
-{
- notmuch_database_t *db;
- notmuch_status_t stat;
- char *msg = NULL;
- notmuch_message_t *message = NULL;
- const char *id = "1258471718-6781-1-git-send-email-dottedmag@dottedmag.net";
-
- stat = notmuch_database_open_verbose (argv[1], NOTMUCH_DATABASE_MODE_READ_WRITE, &db, &msg);
- if (stat != NOTMUCH_STATUS_SUCCESS) {
- fprintf (stderr, "error opening database: %d %s\n", stat, msg ? msg : "");
- exit (1);
- }
- EXPECT0(notmuch_database_find_message (db, id, &message));
- EXPECT0(notmuch_database_close (db));
-EOF
-
-test_begin_subtest "Handle getting message-id from closed database"
-cat c_head2 - c_tail <<'EOF' | test_C ${MAIL_DIR}
- {
- const char *id2;
- id2=notmuch_message_get_message_id (message);
- printf("%d\n%d\n", message != NULL, id2==NULL);
- }
-EOF
-cat <<EOF > EXPECTED
-== stdout ==
-1
-1
-== stderr ==
-EOF
-test_expect_equal_file EXPECTED OUTPUT
-
-test_begin_subtest "Handle getting thread-id from closed database"
-cat c_head2 - c_tail <<'EOF' | test_C ${MAIL_DIR}
- {
- const char *id2;
- id2=notmuch_message_get_thread_id (message);
- printf("%d\n%d\n", message != NULL, id2==NULL);
- }
-EOF
-cat <<EOF > EXPECTED
-== stdout ==
-1
-1
-== stderr ==
-EOF
-test_expect_equal_file EXPECTED OUTPUT
-