aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2021-01-09 15:05:58 -0400
committerDavid Bremner <david@tethera.net>2021-02-06 19:56:13 -0400
commit0345bc57a0d00d576c0e8bccc23fd448736a4511 (patch)
treea83fba9bac8eae44a7a3904cd7e5d0c7b669e94a /test
parent4922416cccb826483e8306461a15a7372e97d3ce (diff)
lib/open: set HOOK_DIR on open
This is a simple two step path search. Most error checking is deferred until running the hooks.
Diffstat (limited to 'test')
-rwxr-xr-xtest/T590-libconfig.sh33
1 files changed, 32 insertions, 1 deletions
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index e2050b50..e7e6e08a 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -201,6 +201,37 @@ EOF
test_expect_equal_file EXPECTED OUTPUT
restore_database
+test_begin_subtest "NOTMUCH_CONFIG_HOOK_DIR: traditional"
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${NOTMUCH_CONFIG} %NULL%
+{
+ const char *val = notmuch_config_get (db, NOTMUCH_CONFIG_HOOK_DIR);
+ printf("database.hook_dir = %s\n", val);
+}
+EOF
+cat <<'EOF' >EXPECTED
+== stdout ==
+database.hook_dir = MAIL_DIR/.notmuch/hooks
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "NOTMUCH_CONFIG_HOOK_DIR: xdg"
+dir="${HOME}/.config/notmuch/default/hooks"
+mkdir -p $dir
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${NOTMUCH_CONFIG} %NULL%
+{
+ const char *val = notmuch_config_get (db, NOTMUCH_CONFIG_HOOK_DIR);
+ printf("database.hook_dir = %s\n", val);
+}
+EOF
+cat <<'EOF' >EXPECTED
+== stdout ==
+database.hook_dir = CWD/home/.config/notmuch/default/hooks
+== stderr ==
+EOF
+rmdir $dir
+test_expect_equal_file EXPECTED OUTPUT
+
test_begin_subtest "notmuch_config_get_values"
cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${NOTMUCH_CONFIG} %NULL%
{
@@ -333,7 +364,7 @@ EOF
cat <<'EOF' >EXPECTED
== stdout ==
MAIL_DIR
-NULL
+MAIL_DIR/.notmuch/hooks
inbox;unread
NULL