From: Jani Nikula Date: Sat, 4 Aug 2012 07:41:42 +0000 (+0300) Subject: [PATCH v2 4/7] test: add smoke tests for the date/time parser module X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=4ed5d1cf9f7638f30697cf86a7fb02c66d57f1f6;p=notmuch-archives.git [PATCH v2 4/7] test: add smoke tests for the date/time parser module --- diff --git a/e4/f0913770ce99bbe3902c49615383861b999c8c b/e4/f0913770ce99bbe3902c49615383861b999c8c new file mode 100644 index 000000000..809878ef9 --- /dev/null +++ b/e4/f0913770ce99bbe3902c49615383861b999c8c @@ -0,0 +1,123 @@ +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 1F483431FAF + for ; Sat, 4 Aug 2012 00:42:18 -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 dT5EfMqXj2q8 for ; + Sat, 4 Aug 2012 00:42:17 -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 136B4431FB6 + for ; Sat, 4 Aug 2012 00:42:11 -0700 (PDT) +Received: by mail-lpp01m010-f53.google.com with SMTP id u2so844636lag.26 + for ; Sat, 04 Aug 2012 00:42:11 -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=K2h8eZUVEdZbrnEpiZbcEcyx5LQQeN85uxP8CQLF7H4=; + b=pSPDLyvEqaCxsmWdP+vvEXqq/2BsqZf40V192iLsusqmcLqLgfjgwYSkIh907gNVFC + YLektxJCwEQjeZd0vP9vNe54YtMXx4tAgikRCo9GXj6m5NKBmy2GiQUMdezHjlcroQYA + isQ5924TKsl0PhSlzfc/U0tQ/D8CIPYA/N1yQb25LM0t12meNKR807Z+3w+qdAAcbvh7 + Ej6Wsgi5cwEFajFgYKTrpWH/WQGsVeHP10SVhyhNDn2Ocq2Z+OLpkSQdrJnIHOvzz+dA + Bqx7o0vaeNn0z4uctJ9er+bkXA3bP9d6HNkHtm61aIWPty0M3r1gNuXiVq13GT0/WHTK + fh+g== +Received: by 10.152.112.34 with SMTP id in2mr4012182lab.6.1344066131637; + Sat, 04 Aug 2012 00:42:11 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi. + [80.223.81.27]) + by mx.google.com with ESMTPS id sy1sm10831134lab.13.2012.08.04.00.42.09 + (version=SSLv3 cipher=OTHER); Sat, 04 Aug 2012 00:42:10 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH v2 4/7] test: add smoke tests for the date/time parser module +Date: Sat, 4 Aug 2012 10:41:42 +0300 +Message-Id: + <76bd571d6a70b7714a6e295ba532b1db023c1b5b.1344065790.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: + ALoCoQk22uq62lqLjjZ77G7Evlux2RunFsSZVNSNACMStyJqI1yRZa516dA5qDtlQLOvVOrbtlXt +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: Sat, 04 Aug 2012 07:42:18 -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 ea39dfc..80e687e 100755 +--- a/test/notmuch-test ++++ b/test/notmuch-test +@@ -59,6 +59,7 @@ TESTS=" + emacs-address-cleaning + emacs-hello + emacs-show ++ 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 +