Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 73 / 1d5f94eec67b879934e9022c5f4989023b7cc9
1 Return-Path: <sojkam1@fel.cvut.cz>\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 D62B6431FBD\r
6         for <notmuch@notmuchmail.org>; Wed,  3 Feb 2010 05:52:42 -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: -2.317\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.317 tagged_above=-999 required=5 tests=[AWL=0.282,\r
12         BAYES_00=-2.599] autolearn=ham\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 Og351Xxaxyci for <notmuch@notmuchmail.org>;\r
16         Wed,  3 Feb 2010 05:52:41 -0800 (PST)\r
17 Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])\r
18         by olra.theworths.org (Postfix) with ESMTP id 8B473431FAE\r
19         for <notmuch@notmuchmail.org>; Wed,  3 Feb 2010 05:52:41 -0800 (PST)\r
20 Received: from localhost (unknown [192.168.200.4])\r
21         by max.feld.cvut.cz (Postfix) with ESMTP id F367319F3372\r
22         for <notmuch@notmuchmail.org>; Wed,  3 Feb 2010 14:52:40 +0100 (CET)\r
23 X-Virus-Scanned: IMAP AMAVIS\r
24 Received: from max.feld.cvut.cz ([192.168.200.1])\r
25         by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new,\r
26         port 10044) with ESMTP id Z2maKPtCHOuc for <notmuch@notmuchmail.org>;\r
27         Wed,  3 Feb 2010 14:52:35 +0100 (CET)\r
28 Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])\r
29         by max.feld.cvut.cz (Postfix) with ESMTP id AEF5819F35E3\r
30         for <notmuch@notmuchmail.org>; Wed,  3 Feb 2010 14:42:55 +0100 (CET)\r
31 Received: from localhost.localdomain (k335-30.felk.cvut.cz [147.32.86.30])\r
32         (Authenticated sender: sojkam1)\r
33         by imap.feld.cvut.cz (Postfix) with ESMTPSA id 8650AFA006\r
34         for <notmuch@notmuchmail.org>; Wed,  3 Feb 2010 14:42:55 +0100 (CET)\r
35 From: Michal Sojka <sojkam1@fel.cvut.cz>\r
36 To: notmuch@notmuchmail.org\r
37 Date: Wed,  3 Feb 2010 14:42:48 +0100\r
38 Message-Id: <1265204568-24018-4-git-send-email-sojkam1@fel.cvut.cz>\r
39 X-Mailer: git-send-email 1.6.6\r
40 In-Reply-To: <1265204568-24018-1-git-send-email-sojkam1@fel.cvut.cz>\r
41 References: <1265204568-24018-1-git-send-email-sojkam1@fel.cvut.cz>\r
42 Subject: [notmuch] [PATCH 4/4] Content of the test script updated to the new\r
43         framework\r
44 X-BeenThere: notmuch@notmuchmail.org\r
45 X-Mailman-Version: 2.1.13\r
46 Precedence: list\r
47 List-Id: "Use and development of the notmuch mail system."\r
48         <notmuch.notmuchmail.org>\r
49 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
52 List-Post: <mailto:notmuch@notmuchmail.org>\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
54 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
55         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
56 X-List-Received-Date: Wed, 03 Feb 2010 13:52:43 -0000\r
57 \r
58 The changes are:\r
59 - Removed helper functions which were moved to test-lib.sh\r
60 - Replaced every echo with test_expect_success.\r
61 - Replaced $NOTMUCH with notmuch (test-lib.sh sets $PATH appropriately)\r
62 - Test commands chained with && (test-lib.sh doesn't use "set -e" in\r
63   order to complete the test suite even if something fails)\r
64 - Quoted ${MAIL_DIR} and other variables as they contains spaces\r
65 - ${TEST_DIR} replaced by ./\r
66 \r
67 To run the whole test suite run\r
68     make\r
69 \r
70 To run only the converted test\r
71    ./t0001-notmuch-new.sh\r
72 \r
73 To stop on the first error\r
74    ./t0001-notmuch-new.sh -i\r
75 then mail store and database can be inspected in\r
76 "trash directory.t0001-notmuch-new"\r
77 \r
78 To see the output of tests\r
79    ./t0001-notmuch-new.sh -v\r
80 \r
81 To not remove trash directory at the end:\r
82    ./t0001-notmuch-new.sh -d\r
83 \r
84 Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>\r
85 ---\r
86  test/t0001-notmuch-new.sh |  310 ++++++++++++++++-----------------------------\r
87  1 files changed, 108 insertions(+), 202 deletions(-)\r
88 \r
89 diff --git a/test/t0001-notmuch-new.sh b/test/t0001-notmuch-new.sh\r
90 index d7b85c0..52c64e9 100755\r
91 --- a/test/t0001-notmuch-new.sh\r
92 +++ b/test/t0001-notmuch-new.sh\r
93 @@ -1,220 +1,126 @@\r
94  #!/bin/sh\r
95 -set -e\r
96  \r
97 -find_notmuch_binary ()\r
98 -{\r
99 -    dir=$1\r
100 +test_description='Description of this test...\r
101 +This test checks if command xyzzy does the right thing...\r
102 +'\r
103 +. ./test-lib.sh\r
104  \r
105 -    while [ -n "$dir" ]; do\r
106 -       bin=$dir/notmuch\r
107 -       if [ -x $bin ]; then\r
108 -           echo $bin\r
109 -           return\r
110 -       fi\r
111 -       dir=$(dirname $dir)\r
112 -       if [ "$dir" = "/" ]; then\r
113 -           break\r
114 -       fi\r
115 -    done\r
116 -\r
117 -    echo notmuch\r
118 -}\r
119 -\r
120 -# Generate a new message in the mail directory, with\r
121 -# a unique message ID and subject.\r
122 -#\r
123 -# The filename of the message generated is available as\r
124 -# $gen_msg_filename\r
125 -gen_msg_cnt=0\r
126 -gen_msg_filename=""\r
127 -generate_message ()\r
128 -{\r
129 -    gen_msg_cnt=$((gen_msg_cnt + 1))\r
130 -    gen_msg_name=msg-$(printf "%03d" $gen_msg_cnt)\r
131 -\r
132 -    if [ "$#" = "0" ]; then\r
133 -       gen_msg_filename="${MAIL_DIR}/$gen_msg_name"\r
134 -    else\r
135 -       gen_msg_filename="${MAIL_DIR}/$1/$gen_msg_name"\r
136 -       mkdir -p $(dirname $gen_msg_filename)\r
137 -    fi\r
138 -\r
139 -cat <<EOF >$gen_msg_filename\r
140 -From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
141 -To: Notmuch Test Suite <test_suite@notmuchmail.org>\r
142 -Message-Id: <msg-${gen_msg_cnt}@notmuch-test-suite>\r
143 -Subject: Test message ${gen_msg_filename}\r
144 -Date: Tue, 05 Jan 2010 15:43:57 -0800\r
145 -\r
146 -This is just a test message at ${gen_msg_filename}\r
147 -EOF\r
148 -}\r
149 -\r
150 -do_sleep ()\r
151 -{\r
152 -    sleep 1\r
153 -}\r
154 -\r
155 -TEST_DIR=$(pwd)/test.$$\r
156 -MAIL_DIR=${TEST_DIR}/mail\r
157 -export NOTMUCH_CONFIG=${TEST_DIR}/notmuch-config\r
158 -NOTMUCH=$(find_notmuch_binary $(pwd))\r
159 -\r
160 -rm -rf ${TEST_DIR}\r
161 -mkdir ${TEST_DIR}\r
162 -cd ${TEST_DIR}\r
163 -\r
164 -mkdir ${MAIL_DIR}\r
165 -\r
166 -cat <<EOF > ${NOTMUCH_CONFIG}\r
167 -[database]\r
168 -path=${MAIL_DIR}\r
169 -\r
170 -[user]\r
171 -name=Notmuch Test Suite\r
172 -primary_email=test_suite@notmuchmail.org\r
173 -EOF\r
174 -\r
175 -echo "### Testing \"notmuch new\" with no messages"\r
176 -$NOTMUCH new\r
177 -\r
178 -echo "### Testing \"notmuch new\" with 1 new message"\r
179 +test_expect_success "Testing \"notmuch new\" with no messages" '\r
180 +notmuch new\r
181 +'\r
182  do_sleep\r
183 -generate_message\r
184 -$NOTMUCH new\r
185 -\r
186 -echo "### Testing \"notmuch new\" with 2 new messages"\r
187 +test_expect_success "Testing \"notmuch new\" with 1 new message" '\r
188 +generate_message &&\r
189 +notmuch new\r
190 +'\r
191  do_sleep\r
192 -generate_message\r
193 -generate_message\r
194 -$NOTMUCH new\r
195 -\r
196 -echo "### Testing \"notmuch new\" with no new messages (and a non-empty database)"\r
197 -\r
198 -$NOTMUCH new\r
199 -\r
200 -echo "### Testing \"notmuch new\" with two new directories (one mail)"\r
201 -rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch\r
202 -mkdir ${MAIL_DIR}/def\r
203 -mkdir ${MAIL_DIR}/ghi\r
204 -generate_message def\r
205 -\r
206 -$NOTMUCH new\r
207 -\r
208 -echo "### Testing \"notmuch new\" with two new directories (one mail)---opposite inode order"\r
209 -\r
210 -rm -rf ${MAIL_DIR}/.notmuch\r
211 -mv ${MAIL_DIR}/ghi ${MAIL_DIR}/abc\r
212 -rm ${MAIL_DIR}/def/*\r
213 -generate_message abc\r
214 -\r
215 -$NOTMUCH new\r
216 -\r
217 -echo "### Testing \"notmuch new\" with 1 old message moved into the mail store"\r
218 -rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch\r
219 -generate_message\r
220 -tmp_msg_filename=tmp/$gen_msg_filename\r
221 -mkdir -p $(dirname $tmp_msg_filename)\r
222 -mv $gen_msg_filename $tmp_msg_filename\r
223 +test_expect_success "Testing \"notmuch new\" with 2 new messages" '\r
224 +generate_message &&\r
225 +generate_message &&\r
226 +notmuch new\r
227 +'\r
228 +test_expect_success "Testing \"notmuch new\" with no new messages (and a non-empty database)" '\r
229 +notmuch new\r
230 +'\r
231 +test_expect_success "Testing \"notmuch new\" with two new directories (one mail)" '\r
232 +rm -rf "${MAIL_DIR}"/* "${MAIL_DIR}"/.notmuch &&\r
233 +mkdir "${MAIL_DIR}/def" &&\r
234 +mkdir "${MAIL_DIR}/ghi" &&\r
235 +generate_message def &&\r
236 +notmuch new\r
237 +'\r
238 +test_expect_success "Testing \"notmuch new\" with two new directories (one mail)---opposite inode order" '\r
239 +rm -rf "${MAIL_DIR}/.notmuch" &&\r
240 +mv "${MAIL_DIR}/ghi" "${MAIL_DIR}/abc" &&\r
241 +rm "${MAIL_DIR}/def/"* &&\r
242 +generate_message abc &&\r
243 +notmuch new\r
244 +'\r
245 +test_expect_success "Testing \"notmuch new\" with 1 old message moved into the mail store" '\r
246 +rm -rf "${MAIL_DIR}/"* "${MAIL_DIR}/.notmuch" &&\r
247 +generate_message &&\r
248 +tmp_msg_filename="tmp/notmuch-${this_test}/$(basename "$gen_msg_filename")" &&\r
249 +mkdir -p "$(dirname "$tmp_msg_filename")" &&\r
250 +mv "$gen_msg_filename" "$tmp_msg_filename" &&\r
251 +do_sleep &&\r
252 +notmuch new > /dev/null &&\r
253 +do_sleep &&\r
254 +mv "$tmp_msg_filename" "$gen_msg_filename" &&\r
255 +notmuch new\r
256 +'\r
257  do_sleep\r
258 -$NOTMUCH new > /dev/null\r
259 +test_expect_success "Testing \"notmuch new\" with 1 renamed message" '\r
260 +generate_message &&\r
261 +notmuch new > /dev/null &&\r
262 +do_sleep &&\r
263 +mv "$gen_msg_filename" "${gen_msg_filename}-renamed" &&\r
264 +notmuch new\r
265 +'\r
266  do_sleep\r
267 -mv $tmp_msg_filename $gen_msg_filename\r
268 -$NOTMUCH new\r
269 -\r
270 -echo "### Testing \"notmuch new\" with 1 renamed message"\r
271 -\r
272 +test_expect_success "Testing \"notmuch new\" with 1 deleted message" '\r
273 +rm "${gen_msg_filename}-renamed" &&\r
274 +notmuch new\r
275 +'\r
276  do_sleep\r
277 -generate_message\r
278 -$NOTMUCH new > /dev/null\r
279 +test_expect_success "Testing \"notmuch new\" with a new directory with 3 messages" '\r
280 +generate_message dir &&\r
281 +generate_message dir &&\r
282 +generate_message dir &&\r
283 +notmuch new\r
284 +'\r
285  do_sleep\r
286 -mv $gen_msg_filename ${gen_msg_filename}-renamed\r
287 -$NOTMUCH new\r
288 -\r
289 -echo "### Testing \"notmuch new\" with 1 deleted message"\r
290 -\r
291 +test_expect_success "Testing \"notmuch new\" with a renamed directory of 3 messages" '\r
292 +mv "${MAIL_DIR}/dir" "${MAIL_DIR}/dir-renamed" &&\r
293 +notmuch new\r
294 +'\r
295  do_sleep\r
296 -rm ${gen_msg_filename}-renamed\r
297 -$NOTMUCH new\r
298 -\r
299 -echo "### Testing \"notmuch new\" with a new directory with 3 messages"\r
300 -\r
301 +test_expect_success "Testing \"notmuch new\" with a deleted directory of 3 messages" '\r
302 +rm -rf "${MAIL_DIR}/dir-renamed" &&\r
303 +notmuch new\r
304 +'\r
305  do_sleep\r
306 -generate_message dir\r
307 -generate_message dir\r
308 -generate_message dir\r
309 -\r
310 -$NOTMUCH new\r
311 -\r
312 -echo "### Testing \"notmuch new\" with a renamed directory of 3 messages"\r
313 -\r
314 -do_sleep\r
315 -mv ${MAIL_DIR}/dir ${MAIL_DIR}/dir-renamed\r
316 -\r
317 -$NOTMUCH new\r
318 -\r
319 -echo "### Testing \"notmuch new\" with a deleted directory of 3 messages"\r
320 -\r
321 +test_expect_success "Testing \"notmuch new\" with a new directory with 3 messages (tail of list)" '\r
322 +generate_message zzz &&\r
323 +generate_message zzz &&\r
324 +generate_message zzz &&\r
325 +notmuch new\r
326 +'\r
327  do_sleep\r
328 -rm -rf ${MAIL_DIR}/dir-renamed\r
329 -\r
330 -$NOTMUCH new\r
331 -\r
332 -echo "### Testing \"notmuch new\" with a new directory with 3 messages (tail of list)"\r
333  \r
334 +test_expect_success "Testing \"notmuch new\" with a deleted directory of 3 messages (tail of list)" '\r
335 +rm -rf "${MAIL_DIR}/zzz" &&\r
336 +notmuch new\r
337 +'\r
338 +test_expect_success "Testing \"notmuch new\" with a symlink to an external directory of 1 message" '\r
339 +rm -rf "${MAIL_DIR}/.notmuch" &&\r
340 +mv "${MAIL_DIR}" "./actual_maildir" &&\r
341 +mkdir "${MAIL_DIR}" &&\r
342 +ln -s ../actual_maildir "${MAIL_DIR}/symlink" &&\r
343 +notmuch new\r
344 +'\r
345  do_sleep\r
346 -generate_message zzz\r
347 -generate_message zzz\r
348 -generate_message zzz\r
349 -\r
350 -$NOTMUCH new\r
351 -\r
352 -echo "### Testing \"notmuch new\" with a deleted directory of 3 messages (tail of list)"\r
353  \r
354 +test_expect_success "Testing \"notmuch new\" with a symlink to an external file" '\r
355 +generate_message &&\r
356 +external_msg_filename="$PWD/external/$(basename $gen_msg_filename)" &&\r
357 +mkdir -p "$(dirname "$external_msg_filename")" &&\r
358 +mv "$gen_msg_filename" "$external_msg_filename" &&\r
359 +ln -s "$external_msg_filename" "$gen_msg_filename" &&\r
360 +notmuch new\r
361 +'\r
362 +do_sleep \r
363 +\r
364 +test_expect_success "Testing \"notmuch new\" with a two-level directory with 3 files" '\r
365 +generate_message two/levels &&\r
366 +generate_message two/levels &&\r
367 +generate_message two/levels &&\r
368 +notmuch new\r
369 +'\r
370  do_sleep\r
371 -rm -rf ${MAIL_DIR}/zzz\r
372 -\r
373 -$NOTMUCH new\r
374 -\r
375 -echo "### Testing \"notmuch new\" with a symlink to an external directory of 1 message"\r
376 -\r
377 -rm -rf ${MAIL_DIR}/.notmuch\r
378 -mv ${MAIL_DIR} ${TEST_DIR}/actual_maildir\r
379 -\r
380 -mkdir ${MAIL_DIR}\r
381 -ln -s ${TEST_DIR}/actual_maildir ${MAIL_DIR}/symlink\r
382 -\r
383 -$NOTMUCH new\r
384 -\r
385 -echo "### Testing \"notmuch new\" with a symlink to an external file"\r
386 -do_sleep\r
387 -generate_message\r
388 -external_msg_filename=${TEST_DIR}/external/$(basename $gen_msg_filename)\r
389 -mkdir -p $(dirname $external_msg_filename)\r
390 -mv $gen_msg_filename $external_msg_filename\r
391 -ln -s $external_msg_filename $gen_msg_filename\r
392 -\r
393 -$NOTMUCH new\r
394 -\r
395 -echo "### Testing \"notmuch new\" with a two-level directory with 3 files"\r
396 -\r
397 -do_sleep\r
398 -generate_message two/levels\r
399 -generate_message two/levels\r
400 -generate_message two/levels\r
401 -\r
402 -$NOTMUCH new\r
403 -\r
404 -echo "### Testing \"notmuch new\" with deletion of two-level directory (3 files)"\r
405 -\r
406 -do_sleep\r
407 -rm -rf ${MAIL_DIR}/two\r
408 -\r
409 -$NOTMUCH new\r
410  \r
411 -cat <<EOF\r
412 -Notmuch test suite complete.\r
413 +test_expect_success "Testing \"notmuch new\" with deletion of two-level directory (3 files)" '\r
414 +rm -rf "${MAIL_DIR}/two" &&\r
415 +notmuch new\r
416 +'\r
417  \r
418 -Intermediate state can be examined in:\r
419 -       ${TEST_DIR}\r
420 -EOF\r
421 +test_done\r
422 -- \r
423 1.6.6\r
424 \r