From: Mark Walters Date: Mon, 29 Oct 2012 08:37:36 +0000 (+0000) Subject: [PATCH] contrib: notmuch-pick: add tests X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=fba7d89a732a796cb9078b26f57d0ac2d2cf23ec;p=notmuch-archives.git [PATCH] contrib: notmuch-pick: add tests --- diff --git a/19/b05967770ecea6cd3672737b08143ff98ade85 b/19/b05967770ecea6cd3672737b08143ff98ade85 new file mode 100644 index 000000000..7a70356f8 --- /dev/null +++ b/19/b05967770ecea6cd3672737b08143ff98ade85 @@ -0,0 +1,314 @@ +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 9E965431FBC + for ; Mon, 29 Oct 2012 01:37:51 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.201 +X-Spam-Level: +X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, + 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 ORRS2qa8qnmF for ; + Mon, 29 Oct 2012 01:37:47 -0700 (PDT) +Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com + [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + 48B25431FAF for ; Mon, 29 Oct 2012 01:37:47 -0700 + (PDT) +Received: by mail-wg0-f45.google.com with SMTP id dq12so2960579wgb.2 + for ; Mon, 29 Oct 2012 01:37:44 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer:mime-version + :content-type:content-transfer-encoding; + bh=zNSM7C/DY8PdySu0PkT1uHnudyfT3n6xV3HaOzoNEaM=; + b=DB6lOD8ByQOSYaaUXZfldtWEM30bz/ILA4pUwp8qPGuCR7m+wRiMMrLsOOcq1uzWc+ + RZH3cX9XtvcBT/EtML5Tw3fCX1W7iqLsDkTd2Qp/wzkvUQU58BFtN/9ehP0fFTSQrzYl + ocNQTf1tXFBHqnUyzTa187yWY0RJU4Xe8gFfc4Pz5XW5FkYQLUvThYCfptv0hAkNf7/E + MJW3m7CMzcuDS3bU0R6NwKTQcG5fmxiteGiQGONWaDnLwBlZJL6zHQqdiZwDyRSbm70X + Xy6fIbukDv09QxajoHY/mSrYWJ8x3AxXDvz7vxs0EfdkkzJlWLh7GVAtZSgXIlyNI7uM + /Slg== +Received: by 10.180.94.102 with SMTP id db6mr13846274wib.20.1351499864517; + Mon, 29 Oct 2012 01:37:44 -0700 (PDT) +Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) + by mx.google.com with ESMTPS id gm7sm10249555wib.10.2012.10.29.01.37.42 + (version=TLSv1/SSLv3 cipher=OTHER); + Mon, 29 Oct 2012 01:37:43 -0700 (PDT) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: =?UTF-8?q?=5BPATCH=5D=20contrib=3A=20notmuch-pick=3A=20add=20tests?= +Date: Mon, 29 Oct 2012 08:37:36 +0000 +Message-Id: <1351499856-14136-1-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +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: Mon, 29 Oct 2012 08:37:51 -0000 + +The test should be run using the wrapper test-wrapper.sh. This links +the tests into the normal notmuch TEST_DIRECTORY and runs them from +there. After the test is complete then the links are removed. +--- + +Here are some tests for notmuch-pick. I would have liked to include +the test structure and run them from inside the pick contrib directory +but I couldn't get all the paths to work. + +Hence, this slightly hacky solution of linking the relevant stuff (one +test script and one expected output directory) into the normal notmuch +test directory and running from there. + +Best wishes + +Mark + + contrib/notmuch-pick/README | 5 + + contrib/notmuch-pick/test-wrapper.sh | 16 +++ + contrib/notmuch-pick/test/emacs-pick | 104 ++++++++++++++++++++ + .../notmuch-pick-single-thread | 6 + + .../pick.expected-output/notmuch-pick-tag-inbox | 53 ++++++++++ + 5 files changed, 184 insertions(+), 0 deletions(-) + create mode 100755 contrib/notmuch-pick/test-wrapper.sh + create mode 100755 contrib/notmuch-pick/test/emacs-pick + create mode 100644 contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-single-thread + create mode 100644 contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-tag-inbox + +diff --git a/contrib/notmuch-pick/README b/contrib/notmuch-pick/README +index 8eed974..98251f6 100644 +--- a/contrib/notmuch-pick/README ++++ b/contrib/notmuch-pick/README +@@ -15,6 +15,11 @@ Then after the "(require 'notmuch)" line in your .emacs file add + the line "(require 'notmuch-pick nil t)". This will load notmuch-pick on + your next emacs start. + ++TEST ++ ++Just execute test-wrapper.sh from this directory and it should all ++work. It does require that notmuch has already been built. ++ + USING PICK + + The main key entries to notmuch pick are +diff --git a/contrib/notmuch-pick/test-wrapper.sh b/contrib/notmuch-pick/test-wrapper.sh +new file mode 100755 +index 0000000..3ecf5b9 +--- /dev/null ++++ b/contrib/notmuch-pick/test-wrapper.sh +@@ -0,0 +1,16 @@ ++#!/usr/bin/env bash ++ ++fail() { ++ echo ERROR $1 ++ exit 1 ++} ++ ++export PICK_DIR=$PWD ++ln -s $PWD/test/emacs-pick ../../test/ || fail "emacs pick test exists" ++ln -s $PWD/test/pick.expected-output ../../test/ || fail "pick.expected-output exists" ++ ++cd ../../test || fail "Cannot find test directory" ++./emacs-pick ++ ++rm emacs-pick ++rm pick.expected-output +diff --git a/contrib/notmuch-pick/test/emacs-pick b/contrib/notmuch-pick/test/emacs-pick +new file mode 100755 +index 0000000..9478732 +--- /dev/null ++++ b/contrib/notmuch-pick/test/emacs-pick +@@ -0,0 +1,104 @@ ++#!/usr/bin/env bash ++ ++test_description="emacs interface" ++. test-lib.sh ++ ++EXPECTED=$TEST_DIRECTORY/pick.expected-output ++ ++add_email_corpus ++test_begin_subtest "Do we have emacs" ++test_emacs '(insert "hello\n") ++ (test-output)' ++cat <EXPECTED ++hello ++EOF ++test_expect_equal_file OUTPUT EXPECTED ++ ++test_begin_subtest "Basic notmuch-pick view in emacs" ++test_emacs '(add-to-list (quote load-path) "'$PICK_DIR'") ++ (require (quote notmuch-pick)) ++ (notmuch-pick "tag:inbox") ++ (notmuch-test-wait) ++ (test-output)' ++test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox ++ ++test_begin_subtest "Basic notmuch-pick view in emacs (sync)" ++test_emacs '(setq notmuch-pick-asynchronous-parser nil) ++ (notmuch-pick "tag:inbox") ++ (notmuch-test-wait) ++ (test-output)' ++test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox ++ ++test_begin_subtest "Navigation of notmuch-hello to search results" ++test_emacs '(notmuch-hello) ++ (goto-char (point-min)) ++ (re-search-forward "inbox") ++ (widget-button-press (1- (point))) ++ (notmuch-test-wait) ++ (notmuch-pick-from-search-current-query) ++ (notmuch-test-wait) ++ (test-output)' ++test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox ++ ++test_begin_subtest "Navigation of notmuch-hello to search results (sync)" ++test_emacs '(setq notmuch-pick-asynchronous-parser nil) ++ (notmuch-hello) ++ (goto-char (point-min)) ++ (re-search-forward "inbox") ++ (widget-button-press (1- (point))) ++ (notmuch-test-wait) ++ (notmuch-pick-from-search-current-query) ++ (notmuch-test-wait) ++ (test-output)' ++test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-tag-inbox ++ ++test_begin_subtest "Pick of a single thread (from search)" ++test_emacs '(notmuch-hello) ++ (goto-char (point-min)) ++ (re-search-forward "inbox") ++ (widget-button-press (1- (point))) ++ (notmuch-test-wait) ++ (notmuch-pick-from-search-thread) ++ (notmuch-test-wait) ++ (test-output)' ++test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-single-thread ++ ++test_begin_subtest "Pick of a single thread (sync from search)" ++test_emacs '(delete-other-windows) ++ (setq notmuch-pick-asynchronous-parser nil) ++ (notmuch-hello) ++ (goto-char (point-min)) ++ (re-search-forward "inbox") ++ (widget-button-press (1- (point))) ++ (notmuch-test-wait) ++ (notmuch-pick-from-search-thread) ++ (notmuch-test-wait) ++ (test-output)' ++test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-single-thread ++ ++test_begin_subtest "Pick of a single thread (from show)" ++test_emacs '(notmuch-hello) ++ (goto-char (point-min)) ++ (re-search-forward "inbox") ++ (widget-button-press (1- (point))) ++ (notmuch-test-wait) ++ (notmuch-search-show-thread) ++ (notmuch-pick-from-show-current-query) ++ (notmuch-test-wait) ++ (test-output)' ++test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-single-thread ++ ++test_begin_subtest "Pick of a single thread (sync from show)" ++test_emacs '(setq notmuch-pick-asynchronous-parser nil) ++ (notmuch-hello) ++ (goto-char (point-min)) ++ (re-search-forward "inbox") ++ (widget-button-press (1- (point))) ++ (notmuch-test-wait) ++ (notmuch-search-show-thread) ++ (notmuch-pick-from-show-current-query) ++ (notmuch-test-wait) ++ (test-output)' ++test_expect_equal_file OUTPUT $EXPECTED/notmuch-pick-single-thread ++ ++test_done +diff --git a/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-single-thread b/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-single-thread +new file mode 100644 +index 0000000..c9e5ef8 +--- /dev/null ++++ b/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-single-thread +@@ -0,0 +1,6 @@ ++ 2009-11-17 Mikhail Gusarov ┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox) ++ 2009-11-17 Mikhail Gusarov ├─►[notmuch] [PATCH 2/2] Include to get uint32_t in C++ file with gcc 4.4 (inbox, unread) ++ 2009-11-17 Carl Worth ╰┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox, unread) ++ 2009-11-17 Keith Packard ╰┬► ... (inbox, unread) ++ 2009-11-18 Carl Worth ╰─► ... (inbox, unread) ++End of search results. +diff --git a/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-tag-inbox b/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-tag-inbox +new file mode 100644 +index 0000000..484141e +--- /dev/null ++++ b/contrib/notmuch-pick/test/pick.expected-output/notmuch-pick-tag-inbox +@@ -0,0 +1,53 @@ ++ 2010-12-29 François Boulogne ─►[aur-general] Guidelines: cp, mkdir vs install (inbox, unread) ++ 2010-12-16 Olivier Berger ─►Essai accentué (inbox, unread) ++ 2009-11-18 Chris Wilson ─►[notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (inbox, unread) ++ 2009-11-18 Alex Botero-Lowry ┬►[notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (attachment, inbox, unread) ++ 2009-11-18 Carl Worth ╰─►[notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (inbox, unread) ++ 2009-11-17 Ingmar Vanhassel ┬►[notmuch] [PATCH] Typsos (inbox, unread) ++ 2009-11-18 Carl Worth ╰─► ... (inbox, unread) ++ 2009-11-17 Adrian Perez de Cast ┬►[notmuch] Introducing myself (inbox, signed, unread) ++ 2009-11-18 Keith Packard ├─► ... (inbox, unread) ++ 2009-11-18 Carl Worth ╰─► ... (inbox, unread) ++ 2009-11-17 Israel Herraiz ┬►[notmuch] New to the list (inbox, unread) ++ 2009-11-18 Keith Packard ├─► ... (inbox, unread) ++ 2009-11-18 Carl Worth ╰─► ... (inbox, unread) ++ 2009-11-17 Jan Janak ┬►[notmuch] What a great idea! (inbox, unread) ++ 2009-11-17 Jan Janak ├─► ... (inbox, unread) ++ 2009-11-18 Carl Worth ╰─► ... (inbox, unread) ++ 2009-11-17 Jan Janak ┬►[notmuch] [PATCH] Older versions of install do not support -C. (inbox, unread) ++ 2009-11-18 Carl Worth ╰─► ... (inbox, unread) ++ 2009-11-17 Aron Griffis ┬►[notmuch] archive (inbox, unread) ++ 2009-11-18 Keith Packard ╰┬► ... (inbox, unread) ++ 2009-11-18 Carl Worth ╰─► ... (inbox, unread) ++ 2009-11-17 Keith Packard ┬►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox, unread) ++ 2009-11-18 Carl Worth ╰─►[notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox, unread) ++ 2009-11-17 Lars Kellogg-Stedman ┬►[notmuch] Working with Maildir storage? (inbox, signed, unread) ++ 2009-11-17 Mikhail Gusarov ├┬► ... (inbox, signed, unread) ++ 2009-11-17 Lars Kellogg-Stedman │╰┬► ... (inbox, signed, unread) ++ 2009-11-17 Mikhail Gusarov │ ├─► ... (inbox, unread) ++ 2009-11-17 Keith Packard │ ╰┬► ... (inbox, unread) ++ 2009-11-18 Lars Kellogg-Stedman │ ╰─► ... (inbox, signed, unread) ++ 2009-11-18 Carl Worth ╰─► ... (inbox, unread) ++ 2009-11-17 Mikhail Gusarov ┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox, unread) ++ 2009-11-17 Mikhail Gusarov ├─►[notmuch] [PATCH 2/2] Include to get uint32_t in C++ file with gcc 4.4 (inbox, unread) ++ 2009-11-17 Carl Worth ╰┬►[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox, unread) ++ 2009-11-17 Keith Packard ╰┬► ... (inbox, unread) ++ 2009-11-18 Carl Worth ╰─► ... (inbox, unread) ++ 2009-11-18 Keith Packard ┬►[notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox, unread) ++ 2009-11-18 Alexander Botero-Low ╰─►[notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox, unread) ++ 2009-11-18 Alexander Botero-Low ─►[notmuch] request for pull (inbox, unread) ++ 2009-11-18 Jjgod Jiang ┬►[notmuch] Mac OS X/Darwin compatibility issues (inbox, unread) ++ 2009-11-18 Alexander Botero-Low ╰┬► ... (inbox, unread) ++ 2009-11-18 Jjgod Jiang ╰┬► ... (inbox, unread) ++ 2009-11-18 Alexander Botero-Low ╰─► ... (inbox, unread) ++ 2009-11-18 Rolland Santimano ─►[notmuch] Link to mailing list archives ? (inbox, unread) ++ 2009-11-18 Jan Janak ─►[notmuch] [PATCH] notmuch new: Support for conversion of spool subdirectories into tags (inbox, unread) ++ 2009-11-18 Stewart Smith ─►[notmuch] [PATCH] count_files: sort directory in inode order before statting (inbox, unread) ++ 2009-11-18 Stewart Smith ─►[notmuch] [PATCH 2/2] Read mail directory in inode number order (inbox, unread) ++ 2009-11-18 Stewart Smith ─►[notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++ libs. (inbox, unread) ++ 2009-11-18 Lars Kellogg-Stedman ┬►[notmuch] "notmuch help" outputs to stderr? (attachment, inbox, signed, unread) ++ 2009-11-18 Lars Kellogg-Stedman ╰─► ... (attachment, inbox, signed, unread) ++ 2009-11-17 Mikhail Gusarov ─►[notmuch] [PATCH] Handle rename of message file (inbox, unread) ++ 2009-11-17 Alex Botero-Lowry ┬►[notmuch] preliminary FreeBSD support (attachment, inbox, unread) ++ 2009-11-17 Carl Worth ╰─► ... (inbox, unread) ++End of search results. +-- +1.7.9.1 +