[PATCH v3 4/9] test: add smoke tests for the date/time parser module
authorJani Nikula <jani@nikula.org>
Wed, 12 Sep 2012 21:27:21 +0000 (00:27 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:49:29 +0000 (09:49 -0800)
7c/0679823fb88587c1f733e52d15874d1c750bd3 [new file with mode: 0644]

diff --git a/7c/0679823fb88587c1f733e52d15874d1c750bd3 b/7c/0679823fb88587c1f733e52d15874d1c750bd3
new file mode 100644 (file)
index 0000000..5968797
--- /dev/null
@@ -0,0 +1,124 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 9EABA431FC4\r
+       for <notmuch@notmuchmail.org>; Wed, 12 Sep 2012 14:27:53 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id DC8h1rTbh2mi for <notmuch@notmuchmail.org>;\r
+       Wed, 12 Sep 2012 14:27:52 -0700 (PDT)\r
+Received: from mail-lpp01m010-f53.google.com (mail-lpp01m010-f53.google.com\r
+       [209.85.215.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id DFB81431FD8\r
+       for <notmuch@notmuchmail.org>; Wed, 12 Sep 2012 14:27:47 -0700 (PDT)\r
+Received: by lahc1 with SMTP id c1so1533671lah.26\r
+       for <notmuch@notmuchmail.org>; Wed, 12 Sep 2012 14:27:46 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references\r
+       :in-reply-to:references:x-gm-message-state;\r
+       bh=8JEkk/rSbtgS4PDZMgAQ7yTt9nAsyYMNw+tQkEBh9BU=;\r
+       b=hIqqnr3CwiPFzuOwIShZ8lbQMzHiTuZJ3beUNcoaJ3EQOFljjbIKEqxvz2QED+Lhax\r
+       4/sSeZDTxRkKhj90kiczr7rYOpf0X6ejGDnHfJ62BpsLdgQdSrYJqSk2di10lPjrgmOT\r
+       W6QPM8hNU82z7E67OzLnaxYTXtmoIPD76LuJ3cKS6+B1mAVmvlBotl+IRkFjuY/XmGc7\r
+       vi68F1RNPyJg34/+wjlAYax0cwu3AB9X2U05BfiEpLH8OBCBszKO8QxZHpMKRCRqsF/X\r
+       J0ab6VE5Wtf7cFT3+A3pEJHGPlX0jjXNEyZUeAeC5I4Uy4XTGvFryWevZuglK+03HKwL\r
+       A+3w==\r
+Received: by 10.152.148.34 with SMTP id tp2mr7496752lab.15.1347485266277;\r
+       Wed, 12 Sep 2012 14:27:46 -0700 (PDT)\r
+Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi.\r
+       [80.223.81.27])\r
+       by mx.google.com with ESMTPS id o7sm5533688lbg.4.2012.09.12.14.27.44\r
+       (version=SSLv3 cipher=OTHER); Wed, 12 Sep 2012 14:27:45 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org,\r
+       David Bremner <david@tethera.net>\r
+Subject: [PATCH v3 4/9] test: add smoke tests for the date/time parser module\r
+Date: Thu, 13 Sep 2012 00:27:21 +0300\r
+Message-Id:\r
+ <24186aafbdcb967b8f66c2390c928f3788ab6cbf.1347484177.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.9.5\r
+In-Reply-To: <cover.1347484177.git.jani@nikula.org>\r
+References: <cover.1347484177.git.jani@nikula.org>\r
+In-Reply-To: <cover.1347484177.git.jani@nikula.org>\r
+References: <cover.1347484177.git.jani@nikula.org>\r
+X-Gm-Message-State:\r
+ ALoCoQkQ13CWvqyYTwGo3LAf7kzAXEGz70/2Q8VdJeUHlB9i3WWIc1sktvPUUOnDrAqjAe8Rqz3b\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 12 Sep 2012 21:27:54 -0000\r
+\r
+Test the date/time parser module directly. Just a small sanity test\r
+initially.\r
+---\r
+ test/notmuch-test      |    1 +\r
+ test/parse-time-string |   26 ++++++++++++++++++++++++++\r
+ 2 files changed, 27 insertions(+)\r
+ create mode 100755 test/parse-time-string\r
+\r
+diff --git a/test/notmuch-test b/test/notmuch-test\r
+index cc732c3..7eadfdf 100755\r
+--- a/test/notmuch-test\r
++++ b/test/notmuch-test\r
+@@ -60,6 +60,7 @@ TESTS="\r
+   emacs-hello\r
+   emacs-show\r
+   missing-headers\r
++  parse-time-string\r
+ "\r
+ TESTS=${NOTMUCH_TESTS:=$TESTS}\r
+ \r
+diff --git a/test/parse-time-string b/test/parse-time-string\r
+new file mode 100755\r
+index 0000000..34b80d7\r
+--- /dev/null\r
++++ b/test/parse-time-string\r
+@@ -0,0 +1,26 @@\r
++#!/usr/bin/env bash\r
++test_description="date/time parser module"\r
++. ./test-lib.sh\r
++\r
++# This is currently just a quick sanity/smoke test.\r
++\r
++_date ()\r
++{\r
++    date -d "$*" +%s\r
++}\r
++\r
++_parse_time ()\r
++{\r
++    ${TEST_DIRECTORY}/parse-time --format=%s "$*"\r
++}\r
++\r
++test_begin_subtest "date(1) default format without TZ code"\r
++test_expect_equal "$(_parse_time Fri Aug 3 23:06:06 2012)" "$(_date Fri Aug 3 23:06:06 2012)"\r
++\r
++test_begin_subtest "date(1) --rfc-2822 format"\r
++test_expect_equal "$(_parse_time Fri, 03 Aug 2012 23:07:46 +0100)" "$(_date Fri, 03 Aug 2012 23:07:46 +0100)"\r
++\r
++test_begin_subtest "date(1) --rfc=3339=seconds format"\r
++test_expect_equal "$(_parse_time 2012-08-03 23:09:37+03:00)" "$(_date 2012-08-03 23:09:37+03:00)"\r
++\r
++test_done\r
+-- \r
+1.7.9.5\r
+\r