diff options
| author | David Bremner <david@tethera.net> | 2020-08-01 09:26:02 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2020-08-03 21:03:43 -0300 |
| commit | e3f88436b7850ac04468416223e136eaaca4aee3 (patch) | |
| tree | 90f209bdbf4a671a401e1e2f534b34740c61333d | |
| parent | a0b2a54aa7514c3360c791fc186848df49a8c5fd (diff) | |
test: regression test for traversing config list with closed db
Also mention error return in API docs
| -rw-r--r-- | lib/notmuch.h | 1 | ||||
| -rwxr-xr-x | test/T590-libconfig.sh | 22 |
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/notmuch.h b/lib/notmuch.h index 9a2a3b1f..f3cb0fe2 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -2291,6 +2291,7 @@ notmuch_config_list_key (notmuch_config_list_t *config_list); * next call to notmuch_config_list_value or notmuch config_list_destroy * * @since libnotmuch 4.4 (notmuch 0.23) + * @retval NULL for errors */ const char * notmuch_config_list_value (notmuch_config_list_t *config_list); diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh index 602fad0b..360e45b0 100755 --- a/test/T590-libconfig.sh +++ b/test/T590-libconfig.sh @@ -100,6 +100,28 @@ zzzafter afterval EOF test_expect_equal_file EXPECTED OUTPUT +test_begin_subtest "notmuch_database_get_config_list: all pairs (closed db)" +cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} +{ + notmuch_config_list_t *list; + EXPECT0(notmuch_database_get_config_list (db, "", &list)); + EXPECT0(notmuch_database_close (db)); + for (; notmuch_config_list_valid (list); notmuch_config_list_move_to_next (list)) { + printf("%s %d\n", notmuch_config_list_key (list), NULL == notmuch_config_list_value(list)); + } + notmuch_config_list_destroy (list); +} +EOF +cat <<'EOF' >EXPECTED +== stdout == +aaabefore 1 +testkey1 1 +testkey2 1 +zzzafter 1 +== stderr == +EOF +test_expect_equal_file EXPECTED OUTPUT + test_begin_subtest "notmuch_database_get_config_list: one prefix" cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} { |
