aboutsummaryrefslogtreecommitdiff
path: root/test/T590-libconfig.sh
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2020-12-24 16:10:05 -0400
committerDavid Bremner <david@tethera.net>2021-02-06 19:03:36 -0400
commit06a64cf0aa2bc3de083d0c317726863ebeed504f (patch)
treee9cfa4842af8cc4049c4dc7eb1037bbeaf4e5f2a /test/T590-libconfig.sh
parentd6bd87a712c6df3126589ec223f4c599fa8450b5 (diff)
lib/open: load default values for known configuration keys.
This emulates the behaviour of notmuch_config_open defined in the CLI, in that it fills in default values if they are not otherwise defined.
Diffstat (limited to 'test/T590-libconfig.sh')
-rwxr-xr-xtest/T590-libconfig.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index fcd96876..0c148ad9 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -239,6 +239,33 @@ EOF
test_expect_equal_file EXPECTED OUTPUT
restore_database
+test_begin_subtest "load default values"
+export MAILDIR=${MAIL_DIR}
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} '' %NULL%
+{
+ notmuch_config_key_t key;
+ for (key = NOTMUCH_CONFIG_FIRST;
+ key < NOTMUCH_CONFIG_LAST;
+ key = (notmuch_config_key_t)(key + 1)) {
+ const char *val = notmuch_config_get (db, key);
+ printf("%s\n", val ? val : "NULL" );
+ }
+}
+EOF
+cat <<'EOF' >EXPECTED
+== stdout ==
+MAIL_DIR
+
+inbox;unread
+true
+NULL
+NULL
+NULL
+== stderr ==
+EOF
+unset MAILDIR
+test_expect_equal_file EXPECTED OUTPUT
+
backup_database
test_begin_subtest "override config from \${NOTMUCH_CONFIG}"
notmuch config set test.key1 overridden