1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
| | #!/usr/bin/env bash
test_description='notmuch config'
. ./test-lib.sh
config_options=(
"database.path"
"user.name"
"user.primary_email"
"user.other_email"
"new.tags"
"maildir.synchronize_flags"
)
test_begin_subtest 'getting config: "config get <section>.<item>"'
echo -n "" > OUTPUT
for i in ${config_options[*]} ; do
notmuch config get "${i}"
done >> OUTPUT
cat >EXPECTED <<EOF
${MAIL_DIR}
Notmuch Test Suite
test_suite@notmuchmail.org
test_suite_other@notmuchmail.org
test_suite@otherdomain.org
unread
inbox
true
EOF
test_expect_equal_file OUTPUT EXPECTED
test_begin_subtest 'setting config: "config set <section>.<item> [values ...]"'
notmuch config set database.path /path/to/maildir
notmuch config set user.name "User Name"
notmuch config set user.primary_email primary_email@notmuchmail.org
notmuch config set user.other_email alt1@notmuchmail.org alt2@notmuchmail.org
notmuch config set new.tags tag1 tag2 tag3
notmuch config set maildir.synchronize_flags false
echo -n "" > OUTPUT
for i in ${config_options[*]} ; do
notmuch config get "${i}"
done >> OUTPUT
cat >EXPECTED <<EOF
/path/to/maildir
User Name
primary_email@notmuchmail.org
alt1@notmuchmail.org
alt2@notmuchmail.org
tag1
tag2
tag3
false
EOF
test_expect_equal_file OUTPUT EXPECTED
test_begin_subtest 'removing config: "config set <section>.<item>"'
notmuch config set database.path
notmuch config set user.name
notmuch config set user.primary_email
notmuch config set user.other_email
notmuch config set new.tags
notmuch config set maildir.synchronize_flags
echo -n "" > OUTPUT
for i in ${config_options[*]} ; do
notmuch config get "${i}"
done >> OUTPUT
# FIXME: Not the most robust nor portable solution here...
# Especially `hostname --domain' may have unwanted effects on
# some platforms, e.g. setting your hostname to "--domain" ;)
fallback_name="$(grep $(id -un) /etc/passwd | cut -d ":" -f 5 | cut -d "," -f 1)"
fallback_email="$(id -un)@$(hostname).$(hostname --domain)"
cat >EXPECTED <<EOF
${HOME}/mail
${fallback_name}
${fallback_email}
unread
inbox
true
EOF
test_expect_equal_file OUTPUT EXPECTED
test_done
|