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 AA96D431FAE for ; Mon, 10 Dec 2012 13:31:52 -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 7C1Abyn54Iks for ; Mon, 10 Dec 2012 13:31:52 -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 CA480431FAF for ; Mon, 10 Dec 2012 13:31:51 -0800 (PST) Received: by mail-lb0-f181.google.com with SMTP id ge1so2519615lbb.26 for ; Mon, 10 Dec 2012 13:31:50 -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=RQmCtEZSIcxD+vxLUFVUVJPRUfqYYro/3VpyA8iKXkU=; b=X6csyaxGbLVyOatjIJSSKJ4Gh1yXI3aBZW3slDh0R/6pmKL/JFyvGmkZWVYbRbeluk +X4GX0+Gcfrr9ka4HrhjDlm/tiDqBZtDYznJoBqtJgx7RXE7zxHp63P2uElerAWvV7ip thi1XaojCJNZ1bzdNczR3zs/Doq9IlRzILutk5RRTcRD4Ob+LNSWQZLzEIAyEEMCKuPI oMAUL5BTPNN89A5hlXmFA4l7/CXbLsasWlf8Vhod6cDtofz/ZEtG/tzLMMXkqO5GQ5Ws tM6UaglShtOJb2OsCD67RRe81AtL27Bc1R6Gf4CQMPffBNUaMIzxZqXBj3dDtqPJX/Lv WDHw== Received: by 10.152.135.139 with SMTP id ps11mr15120000lab.29.1355175110300; Mon, 10 Dec 2012 13:31:50 -0800 (PST) Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi. [80.223.81.27]) by mx.google.com with ESMTPS id bf3sm8422583lbb.16.2012.12.10.13.31.47 (version=SSLv3 cipher=OTHER); Mon, 10 Dec 2012 13:31:48 -0800 (PST) From: Jani Nikula To: david@tethera.net, notmuch@notmuchmail.org Subject: Re: [Patch v6 4/6] test: add test for notmuch tag --batch option In-Reply-To: <1355096008-4544-5-git-send-email-david@tethera.net> References: <1355096008-4544-1-git-send-email-david@tethera.net> <1355096008-4544-5-git-send-email-david@tethera.net> User-Agent: Notmuch/0.14+138~g7041c56 (http://notmuchmail.org) Emacs/23.4.1 (i686-pc-linux-gnu) Date: Mon, 10 Dec 2012 23:31:46 +0200 Message-ID: <87ehixa919.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Gm-Message-State: ALoCoQnLfH9Ahfc/DjlxNWaKNFTeitiE95NOU0H1bpYWoV7yoEoyzXR33X7fQng7wxk+xSt0NZbV 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, 10 Dec 2012 21:31:52 -0000 On Mon, 10 Dec 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. LGTM. > --- > test/tagging | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 51 insertions(+) > > diff --git a/test/tagging b/test/tagging > index 980ff92..0f3d797 100755 > --- a/test/tagging > +++ b/test/tagging > @@ -46,6 +46,57 @@ 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)" > + > +# generate a common input file for the next several tests. > +cat > batch.in < +# %40 is an @ in tag > ++%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 --format=batch-tag > backup.tags > +notmuch tag --input=batch.in > +notmuch search \* | notmuch_search_sanitize > OUTPUT.$test_count > +notmuch restore --format=batch-tag < backup.tags > +test_expect_equal_file batch.expected OUTPUT.$test_count > + > +test_begin_subtest "--batch --input" > +notmuch dump --format=batch-tag > backup.tags > +notmuch tag --batch --input=batch.in > +notmuch search \* | notmuch_search_sanitize > OUTPUT.$test_count > +notmuch restore --format=batch-tag < backup.tags > +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