From: Jani Nikula Date: Fri, 3 Aug 2012 21:51:49 +0000 (+0300) Subject: [PATCH 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=8a7ab863e87f6067cf450ac5a84245afcdedfbc0;p=notmuch-archives.git [PATCH 4/7] test: add smoke tests for the date/time parser module --- diff --git a/fc/be313c57d21aaef5c0baff0b5044e4c34996a4 b/fc/be313c57d21aaef5c0baff0b5044e4c34996a4 new file mode 100644 index 000000000..9e2134149 --- /dev/null +++ b/fc/be313c57d21aaef5c0baff0b5044e4c34996a4 @@ -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 5FC05431FAF + for ; Fri, 3 Aug 2012 14:52:10 -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 E8l+YzmYKd43 for ; + Fri, 3 Aug 2012 14:52:09 -0700 (PDT) +Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com + [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 21CA1431FBF + for ; Fri, 3 Aug 2012 14:52:08 -0700 (PDT) +Received: by mail-lb0-f181.google.com with SMTP id gk1so621084lbb.26 + for ; Fri, 03 Aug 2012 14:52:08 -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=bWsf1sBWrYbJ7kMbQ4QFG4lFe3qbMtGJ0KC1EsyK9NfbMbo3Ea3u6liZ6LZjIOcuCS + i9qBv9IqVFc571oKwrYv88bUvyxJpZ2Czfq2leEfRpM25n4jjwDQM9AbUQBBpUYwE/NX + WSVYMZjlgchz/JWAeBB3+N1bI7INwDOWb0yykttmEflSUGdmxLnDM03KCiEVDKMQGXuQ + fgwauoSP+h01q40EBnAmM13qa4Mdbrxl4L05UFLYMjWTHXOnj8DV/FTevm5ozDNfIVgv + KC+K+bFGlv1+2yqFd2p8EgUxNUVHUuCw/cFF04QtAhBlgycLGJG9svLV+swUCm1KeUbD + KDWg== +Received: by 10.112.36.42 with SMTP id n10mr1246894lbj.7.1344030728721; + Fri, 03 Aug 2012 14:52:08 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi. + [80.223.81.27]) + by mx.google.com with ESMTPS id i4sm2251331lbg.17.2012.08.03.14.52.07 + (version=SSLv3 cipher=OTHER); Fri, 03 Aug 2012 14:52:08 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH 4/7] test: add smoke tests for the date/time parser module +Date: Sat, 4 Aug 2012 00:51:49 +0300 +Message-Id: + +X-Mailer: git-send-email 1.7.9.5 +In-Reply-To: +References: +In-Reply-To: +References: +X-Gm-Message-State: + ALoCoQm0dkkfb8u3SFASfFowLOH/TGwbi1el8wCZP385odT55urSjYURSOwOn+PniOah8zw5WYAf +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: Fri, 03 Aug 2012 21:52:10 -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 +