1 Return-Path: <amdragon@mit.edu>
\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 234C5431FAF
\r
6 for <notmuch@notmuchmail.org>; Mon, 22 Oct 2012 21:23:32 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 CjmIT5I4bvaa for <notmuch@notmuchmail.org>;
\r
16 Mon, 22 Oct 2012 21:23:31 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 088AF431FAE
\r
20 for <notmuch@notmuchmail.org>; Mon, 22 Oct 2012 21:23:30 -0700 (PDT)
\r
21 X-AuditID: 12074422-b7f746d0000008cc-59-50861bc0fd69
\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])
\r
23 by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id B6.1D.02252.0CB16805; Tue, 23 Oct 2012 00:23:28 -0400 (EDT)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q9N4NRWO003459;
\r
27 Tue, 23 Oct 2012 00:23:28 -0400
\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q9N4NQmU026482
\r
32 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
33 Tue, 23 Oct 2012 00:23:27 -0400 (EDT)
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1TQW1W-0001cW-2Z; Tue, 23 Oct 2012 00:23:26 -0400
\r
37 Date: Tue, 23 Oct 2012 00:23:26 -0400
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: Jani Nikula <jani@nikula.org>
\r
40 Subject: Re: [PATCH v5 4/9] test: add smoke tests for the date/time parser
\r
42 Message-ID: <20121023042326.GP14861@mit.edu>
\r
43 References: <cover.1350854171.git.jani@nikula.org>
\r
44 <606a94d565e6b21abfc59d6ba9676a807d669127.1350854171.git.jani@nikula.org>
\r
46 Content-Type: text/plain; charset=us-ascii
\r
47 Content-Disposition: inline
\r
49 <606a94d565e6b21abfc59d6ba9676a807d669127.1350854171.git.jani@nikula.org>
\r
50 User-Agent: Mutt/1.5.21 (2010-09-15)
\r
51 X-Brightmail-Tracker:
\r
52 H4sIAAAAAAAAA+NgFvrLIsWRmVeSWpSXmKPExsUixCmqrHtAui3AYM1UPYum6c4W12/OZHZg
\r
53 8rh1/zW7x7NVt5gDmKK4bFJSczLLUov07RK4Mo71T2Ev+CNX8eb6PLYGxtfiXYwcHBICJhI7
\r
54 ehm7GDmBTDGJC/fWs3UxcnEICexjlFh14zULSEJIYAOjxM81GhD2SSaJiauqIewljBIzTvKB
\r
55 zGERUJV4OTUEJMwmoCGxbf9ysJkiAooSm0/uB7OZBaQlvv1uZgKxhQWCJTa+3MEOYvMK6Ehc
\r
56 3/yKCWSMkECdxPv3ARBhQYmTM5+wQLRqSdz49xKsBGTM8n8cIGFOgTCJCVP+gU0UFVCRmHJy
\r
57 G9sERqFZSLpnIemehdC9gJF5FaNsSm6Vbm5iZk5xarJucXJiXl5qka6pXm5miV5qSukmRlAo
\r
58 s7so7WD8eVDpEKMAB6MSD++Dg60BQqyJZcWVuYcYJTmYlER5XSTbAoT4kvJTKjMSizPii0pz
\r
59 UosPMUpwMCuJ8CoHAJXzpiRWVqUW5cOkpDlYlMR5r6Xc9BcSSE8sSc1OTS1ILYLJynBwKEnw
\r
60 fpICGipYlJqeWpGWmVOCkGbi4AQZzgM0/BpIDW9xQWJucWY6RP4Uo6KUOO8FkIQASCKjNA+u
\r
61 F5ZqXjGKA70izPtaFKiKB5im4LpfAQ1mAhpszgNydXFJIkJKqoFRqG4qyw1pvbPbG/P232EJ
\r
62 D821L2Le/snI50+o4ZagrU+9l81S2+545MmmhyGb2gqebL9tJbk21dbb475YSaPee+5WnbK5
\r
63 9j83MzGezLk3j4FZ+mWGU6OYVZD1nt8nLTt/6YUmOkSnLvzZPGvdzY81EmLiR0VXBxTIcq36
\r
64 unfzK4f291wfJ9YpsRRnJBpqMRcVJwIA4Xfj2hADAAA=
\r
65 Cc: notmuch@notmuchmail.org
\r
66 X-BeenThere: notmuch@notmuchmail.org
\r
67 X-Mailman-Version: 2.1.13
\r
69 List-Id: "Use and development of the notmuch mail system."
\r
70 <notmuch.notmuchmail.org>
\r
71 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
72 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
73 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
74 List-Post: <mailto:notmuch@notmuchmail.org>
\r
75 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
76 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
77 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
78 X-List-Received-Date: Tue, 23 Oct 2012 04:23:32 -0000
\r
80 Quoth Jani Nikula on Oct 22 at 12:22 am:
\r
81 > Test the date/time parser module directly, independent of notmuch,
\r
82 > using the parse-time test tool.
\r
84 > Credits to Michal Sojka <sojkam1@fel.cvut.cz> for writing most of the
\r
87 > test/notmuch-test | 1 +
\r
88 > test/parse-time-string | 71 ++++++++++++++++++++++++++++++++++++++++++++++++
\r
89 > 2 files changed, 72 insertions(+)
\r
90 > create mode 100755 test/parse-time-string
\r
92 > diff --git a/test/notmuch-test b/test/notmuch-test
\r
93 > index cc732c3..7eadfdf 100755
\r
94 > --- a/test/notmuch-test
\r
95 > +++ b/test/notmuch-test
\r
96 > @@ -60,6 +60,7 @@ TESTS="
\r
100 > + parse-time-string
\r
102 > TESTS=${NOTMUCH_TESTS:=$TESTS}
\r
104 > diff --git a/test/parse-time-string b/test/parse-time-string
\r
105 > new file mode 100755
\r
106 > index 0000000..862e701
\r
108 > +++ b/test/parse-time-string
\r
110 > +#!/usr/bin/env bash
\r
111 > +test_description="date/time parser module"
\r
114 > +# Sanity/smoke tests for the date/time parser independent of notmuch
\r
118 > + date -d "$*" +%s
\r
123 > + ${TEST_DIRECTORY}/parse-time --format=%s "$*"
\r
126 > +test_begin_subtest "date(1) default format without TZ code"
\r
127 > +test_expect_equal "$(_parse_time Fri Aug 3 23:06:06 2012)" "$(_date Fri Aug 3 23:06:06 2012)"
\r
129 > +test_begin_subtest "date(1) --rfc-2822 format"
\r
130 > +test_expect_equal "$(_parse_time Fri, 03 Aug 2012 23:07:46 +0100)" "$(_date Fri, 03 Aug 2012 23:07:46 +0100)"
\r
132 > +test_begin_subtest "date(1) --rfc=3339=seconds format"
\r
133 > +test_expect_equal "$(_parse_time 2012-08-03 23:09:37+03:00)" "$(_date 2012-08-03 23:09:37+03:00)"
\r
135 > +test_begin_subtest "Date parser tests"
\r
136 > +REFERENCE=$(_date Tue Jan 11 11:11:00 +0000 2011)
\r
137 > +cat <<EOF > INPUT
\r
138 > +now ==> Tue Jan 11 11:11:00 +0000 2011
\r
139 > +2010-1-1 ==> ERROR: 5
\r
141 It would be nice if these errors were strings. I have no idea if "5"
\r
142 is the right error for this.
\r
144 > +Jan 2 ==> Sun Jan 02 11:11:00 +0000 2011
\r
145 > +Mon ==> Mon Jan 10 11:11:00 +0000 2011
\r
146 > +last Friday ==> ERROR: 4
\r
147 > +2 hours ago ==> ERROR: 1
\r
148 > +last month ==> Sat Dec 11 11:11:00 +0000 2010
\r
149 > +month ago ==> ERROR: 1
\r
150 > +8am ==> Tue Jan 11 08:00:00 +0000 2011
\r
151 > +9:15 ==> Tue Jan 11 09:15:00 +0000 2011
\r
152 > +12:34 ==> Tue Jan 11 12:34:00 +0000 2011
\r
153 > +monday ==> Mon Jan 10 11:11:00 +0000 2011
\r
154 > +yesterday ==> Mon Jan 10 11:11:00 +0000 2011
\r
155 > +tomorrow ==> ERROR: 1
\r
156 > + ==> Tue Jan 11 11:11:00 +0000 2011 # empty string is reference time
\r
158 > +Aug 3 23:06:06 2012 ==> Fri Aug 03 23:06:06 +0000 2012 # date(1) default format without TZ code
\r
159 > +Fri, 03 Aug 2012 23:07:46 +0100 ==> Fri Aug 03 22:07:46 +0000 2012 # rfc-2822
\r
160 > +2012-08-03 23:09:37+03:00 ==> Fri Aug 03 20:09:37 +0000 2012 # rfc-3339 seconds
\r
162 > +10s ==> Tue Jan 11 11:10:50 +0000 2011
\r
163 > +19701223s ==> Fri May 28 10:37:17 +0000 2010
\r
164 > +19701223 ==> Wed Dec 23 11:11:00 +0000 1970
\r
166 > +19701223 +0100 ==> Wed Dec 23 11:11:00 +0000 1970 # Timezone is ignored without an error
\r
168 > +today ==^> Tue Jan 11 23:59:59 +0000 2011
\r
169 > +today ==_> Tue Jan 11 00:00:00 +0000 2011
\r
171 > +thisweek ==^> Sat Jan 15 23:59:59 +0000 2011
\r
172 > +thisweek ==_> Sun Jan 09 00:00:00 +0000 2011
\r
174 > +two months ago==> ERROR: 1 # "ago" is not supported
\r
175 > +two months ==> Thu Nov 11 11:11:00 +0000 2010
\r
177 > +@1348569850 ==> Tue Sep 25 10:44:10 +0000 2012
\r
178 > +@10 ==> Thu Jan 01 00:00:10 +0000 1970
\r
180 Very nice. The only thing that jumps out at me is that there are no
\r
181 ==^^> tests, though it would be interesting to run a code coverage
\r
182 tool to see how thorough these tests are.
\r
186 > +${TEST_DIRECTORY}/parse-time --ref=${REFERENCE} < INPUT > OUTPUT
\r
187 > +test_expect_equal_file INPUT OUTPUT
\r