mirror of
https://git.notmuchmail.org/git/notmuch
synced 2025-02-17 23:53:15 +01:00
test: regression tests for n_q_count_{messages, threads}
At least these exceptions are caught.
This commit is contained in:
parent
0a4c6cdeb1
commit
451c0ce3fc
1 changed files with 46 additions and 0 deletions
|
@ -185,4 +185,50 @@ Query string was: id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net
|
||||||
EOF
|
EOF
|
||||||
test_expect_equal_file EXPECTED OUTPUT
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
|
test_begin_subtest "count messages on closed db"
|
||||||
|
cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
|
||||||
|
{
|
||||||
|
notmuch_query_t *query;
|
||||||
|
const char *str = "id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net";
|
||||||
|
unsigned int count;
|
||||||
|
|
||||||
|
query = notmuch_query_create (db, str);
|
||||||
|
EXPECT0(notmuch_database_close (db));
|
||||||
|
stat = notmuch_query_count_messages (query, &count);
|
||||||
|
|
||||||
|
printf("%d\n", stat == NOTMUCH_STATUS_XAPIAN_EXCEPTION);
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
cat <<EOF > EXPECTED
|
||||||
|
== stdout ==
|
||||||
|
1
|
||||||
|
== stderr ==
|
||||||
|
A Xapian exception occurred performing query: Database has been closed
|
||||||
|
Query string was: id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net
|
||||||
|
EOF
|
||||||
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
|
test_begin_subtest "count threads on closed db"
|
||||||
|
cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
|
||||||
|
{
|
||||||
|
notmuch_query_t *query;
|
||||||
|
const char *str = "id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net";
|
||||||
|
unsigned int count;
|
||||||
|
|
||||||
|
query = notmuch_query_create (db, str);
|
||||||
|
EXPECT0(notmuch_database_close (db));
|
||||||
|
stat = notmuch_query_count_threads (query, &count);
|
||||||
|
|
||||||
|
printf("%d\n", stat == NOTMUCH_STATUS_XAPIAN_EXCEPTION);
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
cat <<EOF > EXPECTED
|
||||||
|
== stdout ==
|
||||||
|
1
|
||||||
|
== stderr ==
|
||||||
|
A Xapian exception occurred performing query: Database has been closed
|
||||||
|
Query string was: id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net
|
||||||
|
EOF
|
||||||
|
test_expect_equal_file EXPECTED OUTPUT
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
Loading…
Add table
Reference in a new issue