From: Mark Walters Date: Sun, 25 Nov 2012 22:50:22 +0000 (+0000) Subject: Re: [Patch v2 11/17] test: add test for notmuch tag --batch option X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=3cbe49520e27a670518f94ffa41c9c45f7646806;p=notmuch-archives.git Re: [Patch v2 11/17] test: add test for notmuch tag --batch option --- diff --git a/14/83fc8fa7263d263267ddaec1420c14852df293 b/14/83fc8fa7263d263267ddaec1420c14852df293 new file mode 100644 index 000000000..3e5e5b5d7 --- /dev/null +++ b/14/83fc8fa7263d263267ddaec1420c14852df293 @@ -0,0 +1,157 @@ +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 4E345431FAF + for ; Sun, 25 Nov 2012 14:50:22 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 Rr9UTucvz4ls for ; + Sun, 25 Nov 2012 14:50:21 -0800 (PST) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 8E5E6431FAE + for ; Sun, 25 Nov 2012 14:50:21 -0800 (PST) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1Tcl1n-0003ZW-Rb; Sun, 25 Nov 2012 22:50:20 +0000 +Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) + (envelope-from ) + id 1Tcl1n-0007V6-IG; Sun, 25 Nov 2012 22:50:19 +0000 +From: Mark Walters +To: david@tethera.net, notmuch@notmuchmail.org +Subject: Re: [Patch v2 11/17] test: add test for notmuch tag --batch option +In-Reply-To: <1353792017-31459-12-git-send-email-david@tethera.net> +References: <1353792017-31459-1-git-send-email-david@tethera.net> + <1353792017-31459-12-git-send-email-david@tethera.net> +User-Agent: Notmuch/0.14+81~g9730584 (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Sun, 25 Nov 2012 22:50:22 +0000 +Message-ID: <87pq31i9g1.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 93.97.24.31 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: ccc5ccceb157cc78b779eae5b27be850 (of first 20000 bytes) +X-SpamAssassin-Score: 3.3 +X-SpamAssassin-SpamBar: +++ +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored 3.3 points. Summary of the scoring: + * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, + * medium trust + * [138.37.6.40 listed in list.dnswl.org] + * 7.5 URIBL_BLACK Contains an URL listed in the URIBL blacklist + * [URIs: batch.in] + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * 1.0 QM_RCVDURI_FREEMAIL Freemail from address with spammy link or + * relayed by spammy host + * -2.9 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +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: Sun, 25 Nov 2012 22:50:22 -0000 + + +Hi + +On Sat, 24 Nov 2012, david@tethera.net wrote: +> From: Jani Nikula +> +> Basic test of functionality, along with all combinations of options. +> --- +> test/tagging | 46 ++++++++++++++++++++++++++++++++++++++++++++++ +> 1 file changed, 46 insertions(+) +> +> diff --git a/test/tagging b/test/tagging +> index 980ff92..e5b8315 100755 +> --- a/test/tagging +> +++ b/test/tagging +> @@ -46,6 +46,52 @@ test_expect_equal "$output" "\ +> thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (:\" inbox tag1 unread) +> thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag4 unread)" +> +> +test_begin_subtest "--batch" +> +notmuch tag --batch < +# %20 is a space in tag +> +-:"%20 -tag1 +tag5 +tag6 -- One +> ++tag1 -tag1 -tag4 +tag4 -- Two +> +-tag6 One +> ++tag5 Two +> +EOF +> +output=$(notmuch search \* | notmuch_search_sanitize) +> +test_expect_equal "$output" "\ +> +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag5 unread) +> +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag5 unread)" +> + +> +> batch.in < +# %20 is a space in tag +> +-:"%20 -tag1 +tag5 +tag6 -- One +> ++tag1 -tag1 -tag4 +tag4 -- Two +> +-tag6 One +> ++tag5 Two +> +EOF +> + +> +test_begin_subtest "--input" +> +notmuch tag --input=batch.in +> +output=$(notmuch search \* | notmuch_search_sanitize) +> +test_expect_equal "$output" "\ +> +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag5 unread) +> +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag5 unread)" + +Wouldn't a different set of tag changes be a better test as presumably +this test can pass if the command just does nothing? + +Mark + +> + +> +test_begin_subtest "--batch --input" +> +notmuch tag --batch --input=batch.in +> +output=$(notmuch search \* | notmuch_search_sanitize) +> +test_expect_equal "$output" "\ +> +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag5 unread) +> +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag5 unread)" +> + +> +test_begin_subtest "--batch, blank lines and comments" +> +notmuch dump | sort > EXPECTED.$test_count +> +notmuch tag --batch < +# this line is a comment; the next has only white space +> + +> + +> +# the previous line is empty +> +EOF +> +notmuch dump | sort > OUTPUT.$test_count +> +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count +> + +> test_expect_code 1 "Empty tag names" 'notmuch tag + One' +> +> test_expect_code 1 "Tag name beginning with -" 'notmuch tag +- One' +> -- +> 1.7.10.4 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch