[PATCH 4/7] test: add smoke tests for the date/time parser module
authorJani Nikula <jani@nikula.org>
Fri, 3 Aug 2012 21:51:49 +0000 (00:51 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:48:48 +0000 (09:48 -0800)
fc/be313c57d21aaef5c0baff0b5044e4c34996a4 [new file with mode: 0644]

diff --git a/fc/be313c57d21aaef5c0baff0b5044e4c34996a4 b/fc/be313c57d21aaef5c0baff0b5044e4c34996a4
new file mode 100644 (file)
index 0000000..9e21341
--- /dev/null
@@ -0,0 +1,123 @@
+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 5FC05431FAF\r
+       for <notmuch@notmuchmail.org>; Fri,  3 Aug 2012 14:52:10 -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 E8l+YzmYKd43 for <notmuch@notmuchmail.org>;\r
+       Fri,  3 Aug 2012 14:52:09 -0700 (PDT)\r
+Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com\r
+       [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 21CA1431FBF\r
+       for <notmuch@notmuchmail.org>; Fri,  3 Aug 2012 14:52:08 -0700 (PDT)\r
+Received: by mail-lb0-f181.google.com with SMTP id gk1so621084lbb.26\r
+       for <notmuch@notmuchmail.org>; Fri, 03 Aug 2012 14:52:08 -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=K2h8eZUVEdZbrnEpiZbcEcyx5LQQeN85uxP8CQLF7H4=;\r
+       b=bWsf1sBWrYbJ7kMbQ4QFG4lFe3qbMtGJ0KC1EsyK9NfbMbo3Ea3u6liZ6LZjIOcuCS\r
+       i9qBv9IqVFc571oKwrYv88bUvyxJpZ2Czfq2leEfRpM25n4jjwDQM9AbUQBBpUYwE/NX\r
+       WSVYMZjlgchz/JWAeBB3+N1bI7INwDOWb0yykttmEflSUGdmxLnDM03KCiEVDKMQGXuQ\r
+       fgwauoSP+h01q40EBnAmM13qa4Mdbrxl4L05UFLYMjWTHXOnj8DV/FTevm5ozDNfIVgv\r
+       KC+K+bFGlv1+2yqFd2p8EgUxNUVHUuCw/cFF04QtAhBlgycLGJG9svLV+swUCm1KeUbD\r
+       KDWg==\r
+Received: by 10.112.36.42 with SMTP id n10mr1246894lbj.7.1344030728721;\r
+       Fri, 03 Aug 2012 14:52:08 -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 i4sm2251331lbg.17.2012.08.03.14.52.07\r
+       (version=SSLv3 cipher=OTHER); Fri, 03 Aug 2012 14:52:08 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 4/7] test: add smoke tests for the date/time parser module\r
+Date: Sat,  4 Aug 2012 00:51:49 +0300\r
+Message-Id:\r
+ <e16a73321088e6f7504e8928c49d8f50797cd46e.1344028781.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.9.5\r
+In-Reply-To: <cover.1344028781.git.jani@nikula.org>\r
+References: <cover.1344028781.git.jani@nikula.org>\r
+In-Reply-To: <cover.1344028781.git.jani@nikula.org>\r
+References: <cover.1344028781.git.jani@nikula.org>\r
+X-Gm-Message-State:\r
+ ALoCoQm0dkkfb8u3SFASfFowLOH/TGwbi1el8wCZP385odT55urSjYURSOwOn+PniOah8zw5WYAf\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: Fri, 03 Aug 2012 21:52:10 -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 ea39dfc..80e687e 100755\r
+--- a/test/notmuch-test\r
++++ b/test/notmuch-test\r
+@@ -59,6 +59,7 @@ TESTS="\r
+   emacs-address-cleaning\r
+   emacs-hello\r
+   emacs-show\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