From: Jani Nikula Date: Mon, 2 Mar 2015 17:47:01 +0000 (+0200) Subject: [PATCH 1/4] test: improve the time parsing tests X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3e34c7a9cddf523a36b1e2878f9e35ac9727e27e;p=notmuch-archives.git [PATCH 1/4] test: improve the time parsing tests --- diff --git a/48/84a9c1e8082ef38f0411623d694784fc4a1aec b/48/84a9c1e8082ef38f0411623d694784fc4a1aec new file mode 100644 index 000000000..9e85e9e44 --- /dev/null +++ b/48/84a9c1e8082ef38f0411623d694784fc4a1aec @@ -0,0 +1,146 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id B14E4431FBF + for ; Mon, 2 Mar 2015 10:20:57 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 1.738 +X-Spam-Level: * +X-Spam-Status: No, score=1.738 tagged_above=-999 required=5 + tests=[DNS_FROM_AHBL_RHSBL=2.438, RCVD_IN_DNSWL_LOW=-0.7] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id jWysR4EzCOU1 for ; + Mon, 2 Mar 2015 10:20:54 -0800 (PST) +Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com + [209.85.212.182]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id A14DD414B82 + for ; Mon, 2 Mar 2015 09:49:27 -0800 (PST) +Received: by wibbs8 with SMTP id bs8so16779851wib.4 + for ; Mon, 02 Mar 2015 09:46:47 -0800 (PST) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:cc:subject:date:message-id; + bh=mKJ1mmlNn9d3I4frYQujpz4/cE2yLE3WRKxrYc0m5a4=; + b=FiP/l6SIOqQ6LK30i/whZMWR+sJFFqNhopE+uIonO+gD9eInvUMfZa4XTk0XTu07SP + 7eJ+IfGy0U7BL6lbxS/VTzNp8cbNT3TEzW1SmPHHaNX6AzEKMZ/ZjWZ+0f6uvfJfvHhQ + rctwGmZzbA+RMW5YYV8BmhWMOpdq1KCGi5XXEiTuqMhUnhxmY8kH9idI8Lf6vNRSHq0m + V5/hWuXdUbDTzvFvFDBCB7/7ItaJGDTgPswJbj/FiDYFo801vI35qPN75ToXK6cYJ+6H + M4aWxpC4cRGnbpqPj59Xw7/zpgTfRGq7tNlRxrT+W80XW3NZM8LJsk4DPKzE0svhj3HZ + dAHQ== +X-Gm-Message-State: + ALoCoQnqa4ViTZOq/AqOitQuGLgVNssuEYA+wTwHaj29HZ2Cm9YO2qYm7acSBKZVEyV9ituRQuzy +X-Received: by 10.180.77.48 with SMTP id p16mr37131215wiw.89.1425318407271; + Mon, 02 Mar 2015 09:46:47 -0800 (PST) +Received: from localhost (mobile-internet-bcee3b-76.dhcp.inet.fi. + [188.238.59.76]) + by mx.google.com with ESMTPSA id r3sm20222614wjw.7.2015.03.02.09.46.45 + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Mon, 02 Mar 2015 09:46:45 -0800 (PST) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH 1/4] test: improve the time parsing tests +Date: Mon, 2 Mar 2015 19:47:01 +0200 +Message-Id: <1425318424-27017-1-git-send-email-jani@nikula.org> +X-Mailer: git-send-email 2.1.4 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 02 Mar 2015 18:20:57 -0000 + +Set the reference time to 12:13:14 instead of 11:11:00 to ensure hours +and minutes are not mixed up, and seconds are really set instead of +defaulted to 00. +--- + test/T490-parse-time-string.sh | 42 +++++++++++++++++++++--------------------- + 1 file changed, 21 insertions(+), 21 deletions(-) + +diff --git a/test/T490-parse-time-string.sh b/test/T490-parse-time-string.sh +index 8ae0b4c24e15..08a834eb1a80 100755 +--- a/test/T490-parse-time-string.sh ++++ b/test/T490-parse-time-string.sh +@@ -24,38 +24,38 @@ test_begin_subtest "date(1) --rfc=3339=seconds format" + test_expect_equal "$(_parse_time 2012-08-03 23:09:37+03:00)" "$(_date 2012-08-03 23:09:37+03:00)" + + test_begin_subtest "Date parser tests" +-REFERENCE=$(_date Tue Jan 11 11:11:00 +0000 2011) ++REFERENCE=$(_date Tue Jan 11 12:13:14 +0000 2011) + cat < INPUT +-now ==> Tue Jan 11 11:11:00 +0000 2011 ++now ==> Tue Jan 11 12:13:14 +0000 2011 + 2010-1-1 ==> ERROR: DATEFORMAT +-Jan 2 ==> Sun Jan 02 11:11:00 +0000 2011 +-Mon ==> Mon Jan 10 11:11:00 +0000 2011 ++Jan 2 ==> Sun Jan 02 12:13:14 +0000 2011 ++Mon ==> Mon Jan 10 12:13:14 +0000 2011 + last Friday ==> ERROR: FORMAT +-2 hours ago ==> Tue Jan 11 09:11:00 +0000 2011 +-last month ==> Sat Dec 11 11:11:00 +0000 2010 +-month ago ==> Sat Dec 11 11:11:00 +0000 2010 +-two mo ==> Thu Nov 11 11:11:00 +0000 2010 +-3M ==> Mon Oct 11 11:11:00 +0000 2010 +-4-mont ==> Sat Sep 11 11:11:00 +0000 2010 +-5m ==> Tue Jan 11 11:06:00 +0000 2011 +-dozen mi ==> Tue Jan 11 10:59:00 +0000 2011 ++2 hours ago ==> Tue Jan 11 10:13:14 +0000 2011 ++last month ==> Sat Dec 11 12:13:14 +0000 2010 ++month ago ==> Sat Dec 11 12:13:14 +0000 2010 ++two mo ==> Thu Nov 11 12:13:14 +0000 2010 ++3M ==> Mon Oct 11 12:13:14 +0000 2010 ++4-mont ==> Sat Sep 11 12:13:14 +0000 2010 ++5m ==> Tue Jan 11 12:08:14 +0000 2011 ++dozen mi ==> Tue Jan 11 12:01:14 +0000 2011 + 8am ==> Tue Jan 11 08:00:00 +0000 2011 + 9:15 ==> Tue Jan 11 09:15:00 +0000 2011 + 12:34 ==> Tue Jan 11 12:34:00 +0000 2011 +-monday ==> Mon Jan 10 11:11:00 +0000 2011 +-yesterday ==> Mon Jan 10 11:11:00 +0000 2011 ++monday ==> Mon Jan 10 12:13:14 +0000 2011 ++yesterday ==> Mon Jan 10 12:13:14 +0000 2011 + tomorrow ==> ERROR: KEYWORD +- ==> Tue Jan 11 11:11:00 +0000 2011 # empty string is reference time ++ ==> Tue Jan 11 12:13:14 +0000 2011 # empty string is reference time + + Aug 3 23:06:06 2012 ==> Fri Aug 03 23:06:06 +0000 2012 # date(1) default format without TZ code + Fri, 03 Aug 2012 23:07:46 +0100 ==> Fri Aug 03 22:07:46 +0000 2012 # rfc-2822 + 2012-08-03 23:09:37+03:00 ==> Fri Aug 03 20:09:37 +0000 2012 # rfc-3339 seconds + +-10s ==> Tue Jan 11 11:10:50 +0000 2011 +-19701223s ==> Fri May 28 10:37:17 +0000 2010 +-19701223 ==> Wed Dec 23 11:11:00 +0000 1970 ++10s ==> Tue Jan 11 12:13:04 +0000 2011 ++19701223s ==> Fri May 28 11:39:31 +0000 2010 ++19701223 ==> Wed Dec 23 12:13:14 +0000 1970 + +-19701223 +0100 ==> Wed Dec 23 11:11:00 +0000 1970 # Timezone is ignored without an error ++19701223 +0100 ==> Wed Dec 23 12:13:14 +0000 1970 # Timezone is ignored without an error + + today ==^^> Wed Jan 12 00:00:00 +0000 2011 + today ==^> Tue Jan 11 23:59:59 +0000 2011 +@@ -65,8 +65,8 @@ this week ==^^> Sun Jan 16 00:00:00 +0000 2011 + this week ==^> Sat Jan 15 23:59:59 +0000 2011 + this week ==_> Sun Jan 09 00:00:00 +0000 2011 + +-two months ago ==> Thu Nov 11 11:11:00 +0000 2010 +-two months ==> Thu Nov 11 11:11:00 +0000 2010 ++two months ago ==> Thu Nov 11 12:13:14 +0000 2010 ++two months ==> Thu Nov 11 12:13:14 +0000 2010 + + @1348569850 ==> Tue Sep 25 10:44:10 +0000 2012 + @10 ==> Thu Jan 01 00:00:10 +0000 1970 +-- +2.1.4 +