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 65E55431FD0
\r
6 for <notmuch@notmuchmail.org>; Sun, 21 Oct 2012 14:22:52 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"
\r
12 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
13 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id nhzba21BklNB for <notmuch@notmuchmail.org>;
\r
17 Sun, 21 Oct 2012 14:22:50 -0700 (PDT)
\r
18 Received: from mail-la0-f53.google.com (mail-la0-f53.google.com
\r
19 [209.85.215.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 79F4E431FBD
\r
22 for <notmuch@notmuchmail.org>; Sun, 21 Oct 2012 14:22:49 -0700 (PDT)
\r
23 Received: by mail-la0-f53.google.com with SMTP id l5so1455559lah.26
\r
24 for <notmuch@notmuchmail.org>; Sun, 21 Oct 2012 14:22:49 -0700 (PDT)
\r
25 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
26 d=google.com; s=20120113;
\r
27 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references
\r
28 :in-reply-to:references:x-gm-message-state;
\r
29 bh=NlWHvNHbEZ6LntzdjDt4E0e/p9bpUaNFz4QnNGNw0Qo=;
\r
30 b=bSSZqLnSNSRxqovNj1ESBQt+xH8BIcrFx90XYKgK20HEAV22HKL/bNzdqsz7M9h3mS
\r
31 +i7c6ecjj6zWN6aDfKGBsMZRkM6m+Rjepebm3E5CKDvWcd/gNZB4cYHb97fYzYq/2g7I
\r
32 m6FIC7HqYlnj3yGzrtOppuatcXimwFtfdGb+L/IZ8LdUnBES6OJ9k1lksWLlAZbIB35T
\r
33 DwI9QWXLOstA6TMNsVaQQ6sqjfm9yyy2Qczc29HPCM9f25zVlTaq7bnJtwpGvg3P8dg7
\r
34 coDMa/0sXJnIFHtHz6wys1toTLCJitpypUabcCCAzxtg/6bWuwoiv2kcykLgNSqMavXw
\r
36 Received: by 10.152.104.50 with SMTP id gb18mr6633608lab.9.1350854569089;
\r
37 Sun, 21 Oct 2012 14:22:49 -0700 (PDT)
\r
38 Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi.
\r
40 by mx.google.com with ESMTPS id p9sm2494829lbc.3.2012.10.21.14.22.47
\r
41 (version=SSLv3 cipher=OTHER); Sun, 21 Oct 2012 14:22:48 -0700 (PDT)
\r
42 From: Jani Nikula <jani@nikula.org>
\r
43 To: notmuch@notmuchmail.org
\r
44 Subject: [PATCH v5 4/9] test: add smoke tests for the date/time parser module
\r
45 Date: Mon, 22 Oct 2012 00:22:27 +0300
\r
47 <606a94d565e6b21abfc59d6ba9676a807d669127.1350854171.git.jani@nikula.org>
\r
48 X-Mailer: git-send-email 1.7.10.4
\r
49 In-Reply-To: <cover.1350854171.git.jani@nikula.org>
\r
50 References: <cover.1350854171.git.jani@nikula.org>
\r
51 In-Reply-To: <cover.1350854171.git.jani@nikula.org>
\r
52 References: <cover.1350854171.git.jani@nikula.org>
\r
54 ALoCoQl3wEJw3CuITRplC+QQd311OTBGCU226X2QeZ1UGTECL7zZrTMpX1971RCsnl4fYDOkbVlB
\r
55 X-BeenThere: notmuch@notmuchmail.org
\r
56 X-Mailman-Version: 2.1.13
\r
58 List-Id: "Use and development of the notmuch mail system."
\r
59 <notmuch.notmuchmail.org>
\r
60 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
61 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
62 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
63 List-Post: <mailto:notmuch@notmuchmail.org>
\r
64 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
65 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
66 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
67 X-List-Received-Date: Sun, 21 Oct 2012 21:22:52 -0000
\r
69 Test the date/time parser module directly, independent of notmuch,
\r
70 using the parse-time test tool.
\r
72 Credits to Michal Sojka <sojkam1@fel.cvut.cz> for writing most of the
\r
75 test/notmuch-test | 1 +
\r
76 test/parse-time-string | 71 ++++++++++++++++++++++++++++++++++++++++++++++++
\r
77 2 files changed, 72 insertions(+)
\r
78 create mode 100755 test/parse-time-string
\r
80 diff --git a/test/notmuch-test b/test/notmuch-test
\r
81 index cc732c3..7eadfdf 100755
\r
82 --- a/test/notmuch-test
\r
83 +++ b/test/notmuch-test
\r
84 @@ -60,6 +60,7 @@ TESTS="
\r
90 TESTS=${NOTMUCH_TESTS:=$TESTS}
\r
92 diff --git a/test/parse-time-string b/test/parse-time-string
\r
93 new file mode 100755
\r
94 index 0000000..862e701
\r
96 +++ b/test/parse-time-string
\r
98 +#!/usr/bin/env bash
\r
99 +test_description="date/time parser module"
\r
102 +# Sanity/smoke tests for the date/time parser independent of notmuch
\r
111 + ${TEST_DIRECTORY}/parse-time --format=%s "$*"
\r
114 +test_begin_subtest "date(1) default format without TZ code"
\r
115 +test_expect_equal "$(_parse_time Fri Aug 3 23:06:06 2012)" "$(_date Fri Aug 3 23:06:06 2012)"
\r
117 +test_begin_subtest "date(1) --rfc-2822 format"
\r
118 +test_expect_equal "$(_parse_time Fri, 03 Aug 2012 23:07:46 +0100)" "$(_date Fri, 03 Aug 2012 23:07:46 +0100)"
\r
120 +test_begin_subtest "date(1) --rfc=3339=seconds format"
\r
121 +test_expect_equal "$(_parse_time 2012-08-03 23:09:37+03:00)" "$(_date 2012-08-03 23:09:37+03:00)"
\r
123 +test_begin_subtest "Date parser tests"
\r
124 +REFERENCE=$(_date Tue Jan 11 11:11:00 +0000 2011)
\r
126 +now ==> Tue Jan 11 11:11:00 +0000 2011
\r
127 +2010-1-1 ==> ERROR: 5
\r
128 +Jan 2 ==> Sun Jan 02 11:11:00 +0000 2011
\r
129 +Mon ==> Mon Jan 10 11:11:00 +0000 2011
\r
130 +last Friday ==> ERROR: 4
\r
131 +2 hours ago ==> ERROR: 1
\r
132 +last month ==> Sat Dec 11 11:11:00 +0000 2010
\r
133 +month ago ==> ERROR: 1
\r
134 +8am ==> Tue Jan 11 08:00:00 +0000 2011
\r
135 +9:15 ==> Tue Jan 11 09:15:00 +0000 2011
\r
136 +12:34 ==> Tue Jan 11 12:34:00 +0000 2011
\r
137 +monday ==> Mon Jan 10 11:11:00 +0000 2011
\r
138 +yesterday ==> Mon Jan 10 11:11:00 +0000 2011
\r
139 +tomorrow ==> ERROR: 1
\r
140 + ==> Tue Jan 11 11:11:00 +0000 2011 # empty string is reference time
\r
142 +Aug 3 23:06:06 2012 ==> Fri Aug 03 23:06:06 +0000 2012 # date(1) default format without TZ code
\r
143 +Fri, 03 Aug 2012 23:07:46 +0100 ==> Fri Aug 03 22:07:46 +0000 2012 # rfc-2822
\r
144 +2012-08-03 23:09:37+03:00 ==> Fri Aug 03 20:09:37 +0000 2012 # rfc-3339 seconds
\r
146 +10s ==> Tue Jan 11 11:10:50 +0000 2011
\r
147 +19701223s ==> Fri May 28 10:37:17 +0000 2010
\r
148 +19701223 ==> Wed Dec 23 11:11:00 +0000 1970
\r
150 +19701223 +0100 ==> Wed Dec 23 11:11:00 +0000 1970 # Timezone is ignored without an error
\r
152 +today ==^> Tue Jan 11 23:59:59 +0000 2011
\r
153 +today ==_> Tue Jan 11 00:00:00 +0000 2011
\r
155 +thisweek ==^> Sat Jan 15 23:59:59 +0000 2011
\r
156 +thisweek ==_> Sun Jan 09 00:00:00 +0000 2011
\r
158 +two months ago==> ERROR: 1 # "ago" is not supported
\r
159 +two months ==> Thu Nov 11 11:11:00 +0000 2010
\r
161 +@1348569850 ==> Tue Sep 25 10:44:10 +0000 2012
\r
162 +@10 ==> Thu Jan 01 00:00:10 +0000 1970
\r
165 +${TEST_DIRECTORY}/parse-time --ref=${REFERENCE} < INPUT > OUTPUT
\r
166 +test_expect_equal_file INPUT OUTPUT
\r