unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jani Nikula <jani@nikula.org>
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	[thread overview]
Message-ID: <76bd571d6a70b7714a6e295ba532b1db023c1b5b.1344065790.git.jani@nikula.org> (raw)
In-Reply-To: <cover.1344065790.git.jani@nikula.org>
In-Reply-To: <cover.1344065790.git.jani@nikula.org>

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

  parent reply	other threads:[~2012-08-04  7:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-04  7:41 [PATCH v2 0/7] notmuch search date:since..until query support Jani Nikula
2012-08-04  7:41 ` [PATCH v2 1/7] build: drop the -Wswitch-enum warning Jani Nikula
2012-08-04  7:41 ` [PATCH v2 2/7] lib: add a date/time parser module Jani Nikula
2012-08-05 13:08   ` David Bremner
2012-08-05 21:43     ` Jani Nikula
2012-08-04  7:41 ` [PATCH v2 3/7] test: add new test tool parse-time for date/time parser Jani Nikula
2012-08-04  7:41 ` Jani Nikula [this message]
2012-08-04  7:41 ` [PATCH v2 5/7] lib: add date range query support Jani Nikula
2012-08-04  7:41 ` [PATCH v2 6/7] test: add tests for date:since..until range queries Jani Nikula
2012-08-04  7:41 ` [PATCH v2 7/7] man: document the " Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=76bd571d6a70b7714a6e295ba532b1db023c1b5b.1344065790.git.jani@nikula.org \
    --to=jani@nikula.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).