Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 82 / ef8b924369556aaa927769f0148ddc7ce019c3
1 Return-Path: <pieter@praet.org>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id D6C46429E35\r
6         for <notmuch@notmuchmail.org>; Sat, 14 Jan 2012 00:59:43 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id mkDZDz4znikZ for <notmuch@notmuchmail.org>;\r
16         Sat, 14 Jan 2012 00:59:42 -0800 (PST)\r
17 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
18         [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 9777A431FB6\r
21         for <notmuch@notmuchmail.org>; Sat, 14 Jan 2012 00:59:42 -0800 (PST)\r
22 Received: by werh12 with SMTP id h12so7105wer.26\r
23         for <notmuch@notmuchmail.org>; Sat, 14 Jan 2012 00:59:41 -0800 (PST)\r
24 Received: by 10.216.133.19 with SMTP id p19mr520462wei.0.1326531581392;\r
25         Sat, 14 Jan 2012 00:59:41 -0800 (PST)\r
26 Received: from localhost ([109.131.75.86])\r
27         by mx.google.com with ESMTPS id fc6sm9708860wbb.16.2012.01.14.00.59.40\r
28         (version=TLSv1/SSLv3 cipher=OTHER);\r
29         Sat, 14 Jan 2012 00:59:40 -0800 (PST)\r
30 From: Pieter Praet <pieter@praet.org>\r
31 To: David Bremner <david@tethera.net>\r
32 Subject: [PATCH] test: cli: getting/setting/removing config values\r
33 Date: Sat, 14 Jan 2012 09:57:56 +0100\r
34 Message-Id: <1326531476-14556-1-git-send-email-pieter@praet.org>\r
35 X-Mailer: git-send-email 1.7.8.1\r
36 In-Reply-To: <8739bir7do.fsf@praet.org>\r
37 References: <8739bir7do.fsf@praet.org>\r
38 Cc: Notmuch Mail <notmuch@notmuchmail.org>\r
39 X-BeenThere: notmuch@notmuchmail.org\r
40 X-Mailman-Version: 2.1.13\r
41 Precedence: list\r
42 List-Id: "Use and development of the notmuch mail system."\r
43         <notmuch.notmuchmail.org>\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
47 List-Post: <mailto:notmuch@notmuchmail.org>\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
51 X-List-Received-Date: Sat, 14 Jan 2012 08:59:44 -0000\r
52 \r
53 Full test coverage for getting, setting and removing options in\r
54 notmuch(1)'s config file ($NOTMUCH_CONFIG or $HOME/.notmuch-config).\r
55 \r
56 ---\r
57 Please *do* take note of the FIXME in the last test!\r
58 \r
59  test/config       |   88 +++++++++++++++++++++++++++++++++++++++++++++++++++++\r
60  test/notmuch-test |    1 +\r
61  2 files changed, 89 insertions(+), 0 deletions(-)\r
62  create mode 100755 test/config\r
63 \r
64 diff --git a/test/config b/test/config\r
65 new file mode 100755\r
66 index 0000000..ee3126c\r
67 --- /dev/null\r
68 +++ b/test/config\r
69 @@ -0,0 +1,88 @@\r
70 +#!/usr/bin/env bash\r
71 +test_description='notmuch config'\r
72 +. ./test-lib.sh\r
73 +\r
74 +\r
75 +config_options=(\r
76 +    "database.path"\r
77 +    "user.name"\r
78 +    "user.primary_email"\r
79 +    "user.other_email"\r
80 +    "new.tags"\r
81 +    "maildir.synchronize_flags"\r
82 +)\r
83 +\r
84 +\r
85 +test_begin_subtest 'getting config: "config get <section>.<item>"'\r
86 +echo -n "" > OUTPUT\r
87 +for i in ${config_options[*]} ; do\r
88 +    notmuch config get "${i}"\r
89 +done >> OUTPUT\r
90 +cat >EXPECTED <<EOF\r
91 +${MAIL_DIR}\r
92 +Notmuch Test Suite\r
93 +test_suite@notmuchmail.org\r
94 +test_suite_other@notmuchmail.org\r
95 +test_suite@otherdomain.org\r
96 +unread\r
97 +inbox\r
98 +true\r
99 +EOF\r
100 +test_expect_equal_file OUTPUT EXPECTED\r
101 +\r
102 +\r
103 +test_begin_subtest 'setting config: "config set <section>.<item> [values ...]"'\r
104 +notmuch config set database.path /path/to/maildir\r
105 +notmuch config set user.name "User Name"\r
106 +notmuch config set user.primary_email primary_email@notmuchmail.org\r
107 +notmuch config set user.other_email alt1@notmuchmail.org alt2@notmuchmail.org\r
108 +notmuch config set new.tags tag1 tag2 tag3\r
109 +notmuch config set maildir.synchronize_flags false\r
110 +echo -n "" > OUTPUT\r
111 +for i in ${config_options[*]} ; do\r
112 +    notmuch config get "${i}"\r
113 +done >> OUTPUT\r
114 +cat >EXPECTED <<EOF\r
115 +/path/to/maildir\r
116 +User Name\r
117 +primary_email@notmuchmail.org\r
118 +alt1@notmuchmail.org\r
119 +alt2@notmuchmail.org\r
120 +tag1\r
121 +tag2\r
122 +tag3\r
123 +false\r
124 +EOF\r
125 +test_expect_equal_file OUTPUT EXPECTED\r
126 +\r
127 +\r
128 +test_begin_subtest 'removing config: "config set <section>.<item>"'\r
129 +notmuch config set database.path\r
130 +notmuch config set user.name\r
131 +notmuch config set user.primary_email\r
132 +notmuch config set user.other_email\r
133 +notmuch config set new.tags\r
134 +notmuch config set maildir.synchronize_flags\r
135 +echo -n "" > OUTPUT\r
136 +for i in ${config_options[*]} ; do\r
137 +    notmuch config get "${i}"\r
138 +done >> OUTPUT\r
139 +\r
140 +# FIXME: Not the most robust nor portable solution here...\r
141 +# Especially `hostname --domain' may have unwanted effects on\r
142 +# some platforms, e.g. setting your hostname to "--domain" ;)\r
143 +fallback_name="$(grep $(id -un) /etc/passwd | cut -d ":" -f 5 | cut -d "," -f 1)"\r
144 +fallback_email="$(id -un)@$(hostname).$(hostname --domain)"\r
145 +\r
146 +cat >EXPECTED <<EOF\r
147 +${HOME}/mail\r
148 +${fallback_name}\r
149 +${fallback_email}\r
150 +unread\r
151 +inbox\r
152 +true\r
153 +EOF\r
154 +test_expect_equal_file OUTPUT EXPECTED\r
155 +\r
156 +\r
157 +test_done\r
158 diff --git a/test/notmuch-test b/test/notmuch-test\r
159 index e40ef86..f0c1d7c 100755\r
160 --- a/test/notmuch-test\r
161 +++ b/test/notmuch-test\r
162 @@ -18,6 +18,7 @@ cd $(dirname "$0")\r
163  \r
164  TESTS="\r
165    basic\r
166 +  config\r
167    help-test\r
168    new\r
169    count\r
170 -- \r
171 1.7.8.1\r
172 \r