Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 64 / c6fb51b9313f75eea2a65a0b19093cf9b3c0f4
1 Return-Path: <jani@nikula.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 0EA76431FBC\r
6         for <notmuch@notmuchmail.org>; Sun, 28 Oct 2012 15:34:59 -0700 (PDT)\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 bR1QhupAFDpB for <notmuch@notmuchmail.org>;\r
16         Sun, 28 Oct 2012 15:34:57 -0700 (PDT)\r
17 Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com\r
18         [209.85.217.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 1E19C431FAF\r
21         for <notmuch@notmuchmail.org>; Sun, 28 Oct 2012 15:34:56 -0700 (PDT)\r
22 Received: by mail-lb0-f181.google.com with SMTP id gg6so3131151lbb.26\r
23         for <notmuch@notmuchmail.org>; Sun, 28 Oct 2012 15:34:55 -0700 (PDT)\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
25         d=google.com; s=20120113;\r
26         h=from:to:cc:subject:in-reply-to:references:user-agent:date\r
27         :message-id:mime-version:content-type:x-gm-message-state;\r
28         bh=BVgN90h2ni5HkjZWbOm1nxgUx+V/A16IJ4bDY97knYk=;\r
29         b=pvGfpC35iSU2xWrw0hGlYmEJTpxCgyGnXpGB+V/av83xTzm7m0VJmV4yoZt7nOHvtY\r
30         1OI8rsD6Q+U6/xYOOV+Tx91wUhf8EhMjUtBWJ4CmCDY5s6ta5sG3bvH3N2z22IdLzKkD\r
31         81TUWelWwvHa58U9H/RB/2o6d3KkiooupBGOv0QBkBQAI87r31n8MTp9XAuzAjTz6VGJ\r
32         Zu3RJsa3zthwBz/uUc3d7jQdJZkW8eDbpVp9LUzv3Vc1hV/OhmJmkGMgeyYk92W5HlJ3\r
33         Qf6xPVPbpQ8GEQKnQz9d1aZkX1YZte0hp6gZYIcKvB6NY4WQcHmjNkdzKK3B2rCJqXTo\r
34         qvAA==\r
35 Received: by 10.112.36.42 with SMTP id n10mr11261456lbj.42.1351463695575;\r
36         Sun, 28 Oct 2012 15:34:55 -0700 (PDT)\r
37 Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi.\r
38         [80.223.81.27])\r
39         by mx.google.com with ESMTPS id g5sm2558418lbk.7.2012.10.28.15.34.52\r
40         (version=SSLv3 cipher=OTHER); Sun, 28 Oct 2012 15:34:53 -0700 (PDT)\r
41 From: Jani Nikula <jani@nikula.org>\r
42 To: Austin Clements <amdragon@MIT.EDU>\r
43 Subject: Re: [PATCH v5 4/9] test: add smoke tests for the date/time parser\r
44         module\r
45 In-Reply-To: <20121023042326.GP14861@mit.edu>\r
46 References: <cover.1350854171.git.jani@nikula.org>\r
47         <606a94d565e6b21abfc59d6ba9676a807d669127.1350854171.git.jani@nikula.org>\r
48         <20121023042326.GP14861@mit.edu>\r
49 User-Agent: Notmuch/0.14+46~g272a1f1 (http://notmuchmail.org) Emacs/23.4.1\r
50         (i686-pc-linux-gnu)\r
51 Date: Mon, 29 Oct 2012 00:34:51 +0200\r
52 Message-ID: <87ip9ukyyc.fsf@nikula.org>\r
53 MIME-Version: 1.0\r
54 Content-Type: text/plain; charset=us-ascii\r
55 X-Gm-Message-State:\r
56  ALoCoQn6DL5ZexPSiH/LuUEYcbvgJD3ct3SI88UPEoaIBtqCPEzPzfbMZXWQq9PRHJzUBYNO3Rk7\r
57 Cc: notmuch@notmuchmail.org\r
58 X-BeenThere: notmuch@notmuchmail.org\r
59 X-Mailman-Version: 2.1.13\r
60 Precedence: list\r
61 List-Id: "Use and development of the notmuch mail system."\r
62         <notmuch.notmuchmail.org>\r
63 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
65 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
66 List-Post: <mailto:notmuch@notmuchmail.org>\r
67 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
68 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
69         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
70 X-List-Received-Date: Sun, 28 Oct 2012 22:34:59 -0000\r
71 \r
72 On Tue, 23 Oct 2012, Austin Clements <amdragon@MIT.EDU> wrote:\r
73 > Quoth Jani Nikula on Oct 22 at 12:22 am:\r
74 >> Test the date/time parser module directly, independent of notmuch,\r
75 >> using the parse-time test tool.\r
76 >> \r
77 >> Credits to Michal Sojka <sojkam1@fel.cvut.cz> for writing most of the\r
78 >> tests.\r
79 >> ---\r
80 >>  test/notmuch-test      |    1 +\r
81 >>  test/parse-time-string |   71 ++++++++++++++++++++++++++++++++++++++++++++++++\r
82 >>  2 files changed, 72 insertions(+)\r
83 >>  create mode 100755 test/parse-time-string\r
84 >> \r
85 >> diff --git a/test/notmuch-test b/test/notmuch-test\r
86 >> index cc732c3..7eadfdf 100755\r
87 >> --- a/test/notmuch-test\r
88 >> +++ b/test/notmuch-test\r
89 >> @@ -60,6 +60,7 @@ TESTS="\r
90 >>    emacs-hello\r
91 >>    emacs-show\r
92 >>    missing-headers\r
93 >> +  parse-time-string\r
94 >>  "\r
95 >>  TESTS=${NOTMUCH_TESTS:=$TESTS}\r
96 >>  \r
97 >> diff --git a/test/parse-time-string b/test/parse-time-string\r
98 >> new file mode 100755\r
99 >> index 0000000..862e701\r
100 >> --- /dev/null\r
101 >> +++ b/test/parse-time-string\r
102 >> @@ -0,0 +1,71 @@\r
103 >> +#!/usr/bin/env bash\r
104 >> +test_description="date/time parser module"\r
105 >> +. ./test-lib.sh\r
106 >> +\r
107 >> +# Sanity/smoke tests for the date/time parser independent of notmuch\r
108 >> +\r
109 >> +_date ()\r
110 >> +{\r
111 >> +    date -d "$*" +%s\r
112 >> +}\r
113 >> +\r
114 >> +_parse_time ()\r
115 >> +{\r
116 >> +    ${TEST_DIRECTORY}/parse-time --format=%s "$*"\r
117 >> +}\r
118 >> +\r
119 >> +test_begin_subtest "date(1) default format without TZ code"\r
120 >> +test_expect_equal "$(_parse_time Fri Aug 3 23:06:06 2012)" "$(_date Fri Aug 3 23:06:06 2012)"\r
121 >> +\r
122 >> +test_begin_subtest "date(1) --rfc-2822 format"\r
123 >> +test_expect_equal "$(_parse_time Fri, 03 Aug 2012 23:07:46 +0100)" "$(_date Fri, 03 Aug 2012 23:07:46 +0100)"\r
124 >> +\r
125 >> +test_begin_subtest "date(1) --rfc=3339=seconds format"\r
126 >> +test_expect_equal "$(_parse_time 2012-08-03 23:09:37+03:00)" "$(_date 2012-08-03 23:09:37+03:00)"\r
127 >> +\r
128 >> +test_begin_subtest "Date parser tests"\r
129 >> +REFERENCE=$(_date Tue Jan 11 11:11:00 +0000 2011)\r
130 >> +cat <<EOF > INPUT\r
131 >> +now          ==> Tue Jan 11 11:11:00 +0000 2011\r
132 >> +2010-1-1     ==> ERROR: 5\r
133 >\r
134 > It would be nice if these errors were strings.  I have no idea if "5"\r
135 > is the right error for this.\r
136 \r
137 Good idea. Will fix.\r
138 \r
139 >> +Jan 2        ==> Sun Jan 02 11:11:00 +0000 2011\r
140 >> +Mon          ==> Mon Jan 10 11:11:00 +0000 2011\r
141 >> +last Friday  ==> ERROR: 4\r
142 >> +2 hours ago  ==> ERROR: 1\r
143 \r
144 I'll silently eat away "ago" too.\r
145 \r
146 >> +last month   ==> Sat Dec 11 11:11:00 +0000 2010\r
147 >> +month ago    ==> ERROR: 1\r
148 >> +8am          ==> Tue Jan 11 08:00:00 +0000 2011\r
149 >> +9:15         ==> Tue Jan 11 09:15:00 +0000 2011\r
150 >> +12:34        ==> Tue Jan 11 12:34:00 +0000 2011\r
151 >> +monday       ==> Mon Jan 10 11:11:00 +0000 2011\r
152 >> +yesterday    ==> Mon Jan 10 11:11:00 +0000 2011\r
153 >> +tomorrow     ==> ERROR: 1\r
154 >> +             ==> Tue Jan 11 11:11:00 +0000 2011 # empty string is reference time\r
155 >> +\r
156 >> +Aug 3 23:06:06 2012             ==> Fri Aug 03 23:06:06 +0000 2012 # date(1) default format without TZ code\r
157 >> +Fri, 03 Aug 2012 23:07:46 +0100 ==> Fri Aug 03 22:07:46 +0000 2012 # rfc-2822\r
158 >> +2012-08-03 23:09:37+03:00       ==> Fri Aug 03 20:09:37 +0000 2012 # rfc-3339 seconds\r
159 >> +\r
160 >> +10s           ==> Tue Jan 11 11:10:50 +0000 2011\r
161 >> +19701223s     ==> Fri May 28 10:37:17 +0000 2010\r
162 >> +19701223      ==> Wed Dec 23 11:11:00 +0000 1970\r
163 >> +\r
164 >> +19701223 +0100 ==> Wed Dec 23 11:11:00 +0000 1970 # Timezone is ignored without an error\r
165 >> +\r
166 >> +today ==^> Tue Jan 11 23:59:59 +0000 2011\r
167 >> +today ==_> Tue Jan 11 00:00:00 +0000 2011\r
168 >> +\r
169 >> +thisweek ==^> Sat Jan 15 23:59:59 +0000 2011\r
170 >> +thisweek ==_> Sun Jan 09 00:00:00 +0000 2011\r
171 >> +\r
172 >> +two months ago==> ERROR: 1 # "ago" is not supported\r
173 >> +two months ==> Thu Nov 11 11:11:00 +0000 2010\r
174 >> +\r
175 >> +@1348569850 ==> Tue Sep 25 10:44:10 +0000 2012\r
176 >> +@10 ==> Thu Jan 01 00:00:10 +0000 1970\r
177 >\r
178 > Very nice.  The only thing that jumps out at me is that there are no\r
179 > ==^^> tests, though it would be interesting to run a code coverage\r
180 > tool to see how thorough these tests are.\r
181 \r
182 Again, most of the credit here goes to Michal Sojka.\r
183 \r
184 Will add some ==^^> tests too.\r
185 \r
186 \r
187 BR,\r
188 Jani.\r
189 \r
190 \r
191 >\r
192 >> +EOF\r
193 >> +\r
194 >> +${TEST_DIRECTORY}/parse-time --ref=${REFERENCE} < INPUT > OUTPUT\r
195 >> +test_expect_equal_file INPUT OUTPUT\r
196 >> +\r
197 >> +test_done\r