From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 8733A431FAF for ; Sat, 1 Dec 2012 16:06:27 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org 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 R27eZCrTp7m4 for ; Sat, 1 Dec 2012 16:06:23 -0800 (PST) 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 9F2FB431FBC for ; Sat, 1 Dec 2012 16:06:22 -0800 (PST) Received: by mail-lb0-f181.google.com with SMTP id ge1so1533590lbb.26 for ; Sat, 01 Dec 2012 16:06:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:in-reply-to:references:user-agent:date:message-id :mime-version:content-type:x-gm-message-state; bh=sLrnMgbnU3wDrN3r99B6O5XpsiHb20Bk1S7FLltorXs=; b=Zqw6Wr5Gv+hgIR2Ir13xuukedMfobtIGS6d1vOipDTlY0bciuMsE2keoehJXtIU2oK O6GaI91jEiW+f66Zv93VEandq3mLuMHNHpbSJpqcoKt7AUVR8mxWOHGTMU2MxhcRX27m fSp/gwzI7H3NQE3x9wRgmlAM+BheZ8nt97nw799P3JUBXh69WLiBS6YU6zFv/Z0h42VO Kumi5JtiVT0JsYhXzNE8UymfYwYlO6LG/Wav6iUgwIOnJ+KCCFnI3IrvAB2v8ma5BGXt XDI28ULyx5ls7yPMPXtooRmIY6WkQxWdANdmARf4Mo3mnfhzdmd3Tn+txwyvPeiNlPt1 holA== Received: by 10.152.104.77 with SMTP id gc13mr5359557lab.16.1354406780793; Sat, 01 Dec 2012 16:06:20 -0800 (PST) Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi. [80.223.81.27]) by mx.google.com with ESMTPS id l9sm3615478lbf.7.2012.12.01.16.06.19 (version=SSLv3 cipher=OTHER); Sat, 01 Dec 2012 16:06:19 -0800 (PST) From: Jani Nikula To: david@tethera.net, notmuch@notmuchmail.org Subject: Re: [PATCH] test: add test for notmuch tag --batch option In-Reply-To: <1354248720-11899-1-git-send-email-david@tethera.net> References: <87pq31i9g1.fsf@qmul.ac.uk> <1354248720-11899-1-git-send-email-david@tethera.net> User-Agent: Notmuch/0.14+124~g3b17402 (http://notmuchmail.org) Emacs/23.4.1 (i686-pc-linux-gnu) Date: Sun, 02 Dec 2012 02:06:17 +0200 Message-ID: <87pq2tqpvq.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Gm-Message-State: ALoCoQkg7Epbssl+OX9LJVB7uPKsxdXLQ8gwixNBCIKs//2sHTe9AGLZ8Mit6zz/VbKnEbW5hvIz 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, 02 Dec 2012 00:06:27 -0000 On Fri, 30 Nov 2012, david@tethera.net wrote: > From: Jani Nikula > > Basic test of functionality, along with all combinations of options. > > Modified extensively by David Bremner > > The choice of @ as a tag is intended to be non-alphanumeric, but still > not too much trouble in the shell and in the old sup dump/restore format. > --- > > Mark: good catch. > > I decided to save restore the tags rather than have > multiple input and output files here. But you have to be careful to not add any fancy tags as we're still using the sup dump format here. > > test/tagging | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 50 insertions(+) > > diff --git a/test/tagging b/test/tagging > index 980ff92..75552e8 100755 > --- a/test/tagging > +++ b/test/tagging > @@ -46,6 +46,56 @@ 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)" > + Perhaps add a comment here that the generated files are used for more than one subtest. > +cat > batch.in < +# %20 is a space in tag True, but what's it got to do with this bit? :p BR, Jani. > ++%40 -tag5 +tag6 -- One > ++tag1 -tag1 -tag4 +tag4 -- Two > +-tag5 +tag6 Two > +EOF > + > +cat > batch.expected < +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; One (@ inbox tag6 unread) > +thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag6 unread) > +EOF > + > +test_begin_subtest "--input" > +notmuch dump > backup.tags.$test_count > +notmuch tag --input=batch.in > +notmuch search \* | notmuch_search_sanitize > OUTPUT.$test_count > +notmuch restore < backup.tags.$test_count > +test_expect_equal_file batch.expected OUTPUT.$test_count > + > +test_begin_subtest "--batch --input" > +notmuch dump > backup.tags.$test_count > +notmuch tag --batch --input=batch.in > +notmuch search \* | notmuch_search_sanitize > OUTPUT.$test_count > +notmuch restore < backup.tags.$test_count > +test_expect_equal_file batch.expected OUTPUT.$test_count > + > +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