From: David Bremner Date: Fri, 24 Jul 2020 11:14:02 +0000 (-0300) Subject: test: add regression test for n_t_get_messages X-Git-Tag: 0.31_rc0~70 X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=commitdiff_plain;h=70b30066f67ea75d405c8a246bf6ed923e2bdd59 test: add regression test for n_t_get_messages This is similar to the case of toplevel messages. Currently everything is cached, so no database access is necessary. This might change in the future, but it should not crash in either case. --- diff --git a/test/T568-lib-thread.sh b/test/T568-lib-thread.sh index 4703950b..c7d4f26b 100755 --- a/test/T568-lib-thread.sh +++ b/test/T568-lib-thread.sh @@ -172,4 +172,30 @@ cat < EXPECTED EOF test_expect_equal_file EXPECTED OUTPUT +test_begin_subtest "iterate over all messages with closed database" +cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} + { + notmuch_messages_t *messages; + for (messages = notmuch_thread_get_messages (thread); + notmuch_messages_valid (messages); + notmuch_messages_move_to_next (messages)) { + notmuch_message_t *message = notmuch_messages_get (messages); + const char *mid = notmuch_message_get_message_id (message); + printf("%s\n", mid); + } + } +EOF +cat < EXPECTED +== stdout == +20091117190054.GU3165@dottiness.seas.harvard.edu +87iqd9rn3l.fsf@vertex.dottedmag +20091117203301.GV3165@dottiness.seas.harvard.edu +87fx8can9z.fsf@vertex.dottedmag +yunaayketfm.fsf@aiko.keithp.com +20091118005040.GA25380@dottiness.seas.harvard.edu +87ocn0qh6d.fsf@yoom.home.cworth.org +== stderr == +EOF +test_expect_equal_file EXPECTED OUTPUT + test_done