2 test_description='Various options for reading configuration'
3 . $(dirname "$0")/test-lib.sh || exit 1
6 local test_name=$(basename $0 .sh)
7 cp ${NOTMUCH_CONFIG} notmuch-config-backup.${test_name}
12 local profile=${1:-default}
13 if [[ $profile != default ]]; then
14 export NOTMUCH_PROFILE=$profile
17 dir="${HOME}/.config/notmuch/${profile}"
20 CONFIG_PATH=$dir/config
21 mv ${NOTMUCH_CONFIG} ${CONFIG_PATH}
26 local test_name=$(basename $0 .sh)
27 export NOTMUCH_CONFIG="${TMP_DIRECTORY}/notmuch-config"
30 cp notmuch-config-backup.${test_name} ${NOTMUCH_CONFIG}
35 test_begin_subtest "count with saved query from config file"
37 query_name="test${RANDOM}"
38 notmuch count query:$query_name > OUTPUT
39 printf "\n[query]\n${query_name} = tag:inbox\n" >> notmuch-config
40 notmuch count query:$query_name >> OUTPUT
46 test_expect_equal_file EXPECTED OUTPUT
48 test_begin_subtest "count with saved query from config file (xdg)"
49 query_name="test${RANDOM}"
51 notmuch count query:$query_name > OUTPUT
52 printf "\n[query]\n${query_name} = tag:inbox\n" >> ${CONFIG_PATH}
53 notmuch count query:$query_name >> OUTPUT
59 test_expect_equal_file EXPECTED OUTPUT
61 test_begin_subtest "count with saved query from config file (xdg+profile)"
62 query_name="test${RANDOM}"
64 notmuch count query:$query_name > OUTPUT
65 printf "\n[query]\n${query_name} = tag:inbox\n" >> ${CONFIG_PATH}
66 notmuch count query:$query_name >> OUTPUT
72 test_expect_equal_file EXPECTED OUTPUT