2 test_description="API tests for notmuch_thread_*"
4 . $(dirname "$0")/test-lib.sh || exit 1
8 test_begin_subtest "building database"
9 test_expect_success "NOTMUCH_NEW"
13 const char *stat_str = notmuch_database_status_string (db);
15 fputs (stat_str, stderr);
24 #include <notmuch-test.h>
25 int main (int argc, char** argv)
27 notmuch_database_t *db;
28 notmuch_status_t stat;
30 notmuch_thread_t *thread = NULL;
31 notmuch_threads_t *threads = NULL;
32 notmuch_query_t *query = NULL;
33 const char *id = "thread:0000000000000009";
35 stat = notmuch_database_open_verbose (argv[1], NOTMUCH_DATABASE_MODE_READ_WRITE, &db, &msg);
36 if (stat != NOTMUCH_STATUS_SUCCESS) {
37 fprintf (stderr, "error opening database: %d %s\n", stat, msg ? msg : "");
41 query = notmuch_query_create (db, id);
42 EXPECT0(notmuch_query_search_threads (query, &threads));
43 thread = notmuch_threads_get (threads);
44 EXPECT0(notmuch_database_close (db));
47 test_begin_subtest "get thread-id from closed database"
48 cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
51 id2 = notmuch_thread_get_thread_id (thread);
52 printf("%d\n%s\n", thread != NULL, id2);
61 test_expect_equal_file EXPECTED OUTPUT