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