From: Pieter Praet Date: Wed, 22 Feb 2012 18:53:55 +0000 (+0100) Subject: Re: [PATCH v2 4/4] test: emacs: new test "notmuch-search: change tags of all matching... X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=018bd3a40d9b2b35d58d302c7c2939aecbe35685;p=notmuch-archives.git Re: [PATCH v2 4/4] test: emacs: new test "notmuch-search: change tags of all matching messages" --- diff --git a/1e/e4734e45f678b0658d47f687d1bd8e3dc9b3ca b/1e/e4734e45f678b0658d47f687d1bd8e3dc9b3ca new file mode 100644 index 000000000..e47551f07 --- /dev/null +++ b/1e/e4734e45f678b0658d47f687d1bd8e3dc9b3ca @@ -0,0 +1,151 @@ +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 4EE5E431FAE + for ; Wed, 22 Feb 2012 10:56:15 -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 5D0L2sRMbegM for ; + Wed, 22 Feb 2012 10:56:14 -0800 (PST) +Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com + [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 1A78A431FBD + for ; Wed, 22 Feb 2012 10:56:13 -0800 (PST) +Received: by wibhi8 with SMTP id hi8so278196wib.26 + for ; Wed, 22 Feb 2012 10:56:13 -0800 (PST) +Received-SPF: pass (google.com: domain of pieter@praet.org designates + 10.180.101.37 as permitted sender) client-ip=10.180.101.37; +Authentication-Results: mr.google.com; + spf=pass (google.com: domain of pieter@praet.org + designates 10.180.101.37 as permitted sender) + smtp.mail=pieter@praet.org +Received: from mr.google.com ([10.180.101.37]) + by 10.180.101.37 with SMTP id fd5mr43888104wib.1.1329936973164 + (num_hops = 1); Wed, 22 Feb 2012 10:56:13 -0800 (PST) +Received: by 10.180.101.37 with SMTP id fd5mr36322257wib.1.1329936973107; + Wed, 22 Feb 2012 10:56:13 -0800 (PST) +Received: from localhost ([109.131.181.26]) + by mx.google.com with ESMTPS id ga1sm74964741wib.5.2012.02.22.10.56.12 + (version=TLSv1/SSLv3 cipher=OTHER); + Wed, 22 Feb 2012 10:56:12 -0800 (PST) +From: Pieter Praet +To: Dmitry Kurochkin , + Notmuch Mail +Subject: Re: [PATCH v2 4/4] test: emacs: new test "notmuch-search: change tags + of all matching messages" +In-Reply-To: <87linxlmji.fsf@gmail.com> +References: <1310313335-4159-1-git-send-email-pieter@praet.org> + <1329683908-5435-1-git-send-email-pieter@praet.org> + <1329683908-5435-5-git-send-email-pieter@praet.org> + <87linxlmji.fsf@gmail.com> +User-Agent: Notmuch/0.11.1+210~g6afc43e (http://notmuchmail.org) Emacs/23.3.1 + (x86_64-unknown-linux-gnu) +Date: Wed, 22 Feb 2012 19:53:55 +0100 +Message-ID: <87booq8zss.fsf@praet.org> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Gm-Message-State: + ALoCoQlPIH3A1lL2H1dPzkjkCyn5kutDth/ad87X3j29IDLPW3PgOfhtsyApty6zN0KWrGvDt6DP +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: Wed, 22 Feb 2012 18:56:15 -0000 + +On Mon, 20 Feb 2012 16:25:05 +0400, Dmitry Kurochkin wrote: +> On Sun, 19 Feb 2012 21:38:28 +0100, Pieter Praet wrote: +> > `notmuch-search-tag-all' (bound to "*") adds and removes tags +> > to/from all messages which match the query used to populate the +> > current search buffer. +> +> LGTM. But since you will need to send a new version to address Tomi's +> comments anyway, below are few minor comments. +> +> Regards, +> Dmitry +> +> > --- +> > test/emacs | 32 ++++++++++++++++++++++++++++++++ +> > 1 files changed, 32 insertions(+), 0 deletions(-) +> > +> > diff --git a/test/emacs b/test/emacs +> > index b0fb760..1db8540 100755 +> > --- a/test/emacs +> > +++ b/test/emacs +> > @@ -124,6 +124,38 @@ test_emacs "(notmuch-show \"$os_x_darwin_thread\") +> > output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize) +> > test_expect_equal "$output" "thread:XXX 2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)" +> > +> > +test_begin_subtest "notmuch-search: change tags of all matching messages" +> > +old_tag="inbox" +> > +new_tag="xobni" +> > +filter="AND from:cworth" +> > +# Get initial tag counts and prevent false positives/negatives +> > +old_tag_count_1=$(notmuch count tag:"${old_tag}" "${filter}") +> > +new_tag_count_1=$(notmuch count tag:"${new_tag}" "${filter}") +> > +test "${old_tag_count_1}" == "0" && old_tag_count_1="Need 1+ matches!" +> +> Consider s/1+/>0/. +> +> > +test "${new_tag_count_1}" == "0" || new_tag_count_1="Need 0 matches!" +> > +# Change tags of all matching messages and get tag counts +> > +test_emacs "(notmuch-search \"tag:${old_tag} ${filter}\") +> > + (notmuch-test-wait) +> > + (notmuch-search-tag-all \"-${old_tag}\" \"+${new_tag}\")" +> > +old_tag_count_2=$(notmuch count tag:"${old_tag}" "${filter}") +> > +new_tag_count_2=$(notmuch count tag:"${new_tag}" "${filter}") +> > +# Revert tag changes and get tag counts +> > +test_emacs "(notmuch-search \"tag:${new_tag} ${filter}\") +> > + (notmuch-test-wait) +> > + (notmuch-search-tag-all \"+${old_tag}\" \"-${new_tag}\")" +> > +old_tag_count_3=$(notmuch count tag:"${old_tag}" "${filter}") +> > +new_tag_count_3=$(notmuch count tag:"${new_tag}" "${filter}") +> > +# ... and verify the results +> > +output=" +> > +before: old:${old_tag_count_1} new:${new_tag_count_1} +> > +after: old:${old_tag_count_2} new:${new_tag_count_2} +> > +restored: old:${old_tag_count_3} new:${new_tag_count_3}" +> > +expected=" +> > +before: old:${old_tag_count_1} new:0 +> > +after: old:0 new:${old_tag_count_1} +> > +restored: old:${old_tag_count_1} new:0" +> > +test_expect_equal "$output" "$expected" +> > + +> +> I would add a newline before every commented block. +> + +Agreed, on all accounts. + + +> Regards, +> Dmitry +> +> > test_begin_subtest "Message with .. in Message-Id:" +> > add_message [id]=123..456@example '[subject]="Message with .. in Message-Id"' +> > test_emacs '(notmuch-search "id:\"123..456@example\"") +> > -- +> > 1.7.8.1 +> > + + +Peace + +-- +Pieter