aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2021-01-01 09:28:24 -0400
committerDavid Bremner <david@tethera.net>2021-02-06 19:09:39 -0400
commitd071828bd5f8aee0437aeb4993ffeeaa803c367b (patch)
tree0a739d38749fa206cff386f22e71e7c65c1b07d5 /test
parentfd6f8e6c30e0443d1ead248047ab572120df85e9 (diff)
lib/config: make values iterators restartable
This is relatively cheap, and makes it easier to transform existing code which uses arrays of pointers to store configuration lists.
Diffstat (limited to 'test')
-rwxr-xr-xtest/T590-libconfig.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index efbee61d..ab439078 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -224,6 +224,38 @@ EOF
test_expect_equal_file EXPECTED OUTPUT
restore_database
+test_begin_subtest "notmuch_config_get_values (restart)"
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${NOTMUCH_CONFIG} %NULL%
+{
+ notmuch_config_values_t *values;
+ EXPECT0(notmuch_config_set (db, NOTMUCH_CONFIG_NEW_TAGS, "a;b;c"));
+ for (values = notmuch_config_get_values (db, NOTMUCH_CONFIG_NEW_TAGS);
+ notmuch_config_values_valid (values);
+ notmuch_config_values_move_to_next (values))
+ {
+ puts (notmuch_config_values_get (values));
+ }
+ for (notmuch_config_values_start (values);
+ notmuch_config_values_valid (values);
+ notmuch_config_values_move_to_next (values))
+ {
+ puts (notmuch_config_values_get (values));
+ }
+}
+EOF
+cat <<'EOF' >EXPECTED
+== stdout ==
+a
+b
+c
+a
+b
+c
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+restore_database
+
backup_database
test_begin_subtest "notmuch_config_get_values, trailing ;"
cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${NOTMUCH_CONFIG} %NULL%