diff options
author | David Bremner <david@tethera.net> | 2020-07-22 07:51:22 -0300 |
---|---|---|
committer | David Bremner <david@tethera.net> | 2020-07-29 12:19:57 -0300 |
commit | d5c84c8289ff57e5ea5745f126f9c0377cb8f413 (patch) | |
tree | e079a0d419fee7c62fe9bcab589ebe74a7bcd89d /test | |
parent | a292461e65c2150b02fc6f9b168dc871b46d44a1 (diff) |
test: regression test for n_q_{set, get}_sort
We just want to make sure accessing the query owned by a closed db
does not cause a crash.
Diffstat (limited to 'test')
-rwxr-xr-x | test/T564-lib-query.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/T564-lib-query.sh b/test/T564-lib-query.sh index ea176191..14e47cfb 100755 --- a/test/T564-lib-query.sh +++ b/test/T564-lib-query.sh @@ -99,4 +99,25 @@ SUCCESS EOF test_expect_equal_file EXPECTED OUTPUT +test_begin_subtest "roundtrip sort 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"; + notmuch_sort_t sort; + + query = notmuch_query_create (db, str); + EXPECT0(notmuch_database_close (db)); + notmuch_query_set_sort (query, NOTMUCH_SORT_UNSORTED); + sort = notmuch_query_get_sort (query); + printf("%d\n", sort == NOTMUCH_SORT_UNSORTED); + } +EOF +cat <<EOF > EXPECTED +== stdout == +1 +== stderr == +EOF +test_expect_equal_file EXPECTED OUTPUT + test_done |