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 B72F3431FB6 for ; Wed, 22 Feb 2012 10:56:50 -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 Rfxo5Va9eIvv for ; Wed, 22 Feb 2012 10:56:43 -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 6B8DA431FAE for ; Wed, 22 Feb 2012 10:56:43 -0800 (PST) Received: by mail-wi0-f181.google.com with SMTP id hi8so278196wib.26 for ; Wed, 22 Feb 2012 10:56:43 -0800 (PST) Received-SPF: pass (google.com: domain of pieter@praet.org designates 10.216.131.23 as permitted sender) client-ip=10.216.131.23; Authentication-Results: mr.google.com; spf=pass (google.com: domain of pieter@praet.org designates 10.216.131.23 as permitted sender) smtp.mail=pieter@praet.org Received: from mr.google.com ([10.216.131.23]) by 10.216.131.23 with SMTP id l23mr9740227wei.37.1329937003289 (num_hops = 1); Wed, 22 Feb 2012 10:56:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=gamma; h=mime-version:from:to:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=nyuJ3PKTjHS4QQeEC9Sl2X23ILZAhndliN5bhky3WQk=; b=lH1mNReCtiR6HR0P2lY199xjgLvN5YAd2XUjfmUaIKS18Kuy6a/O/kD+FrkCA0C13+ kIkX1BwohIHbfEpsBAxYMwQncJ1hBZdTxxpg/dc/eF+7nIb5PZirlUMyZC61qMY5rFQf alktoPo6gWloCD1B5I+vRXChuAO56JRvTnMAg= MIME-Version: 1.0 Received: by 10.216.131.23 with SMTP id l23mr8044182wei.37.1329937003123; Wed, 22 Feb 2012 10:56:43 -0800 (PST) Received: from localhost ([109.131.181.26]) by mx.google.com with ESMTPS id n5sm74947151wiw.7.2012.02.22.10.56.42 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 22 Feb 2012 10:56:42 -0800 (PST) From: Pieter Praet To: Notmuch Mail Subject: [PATCH v3] test: emacs: new test "notmuch-search: change tags of all matching messages" Date: Wed, 22 Feb 2012 19:54:27 +0100 Message-Id: <1329936867-923-1-git-send-email-pieter@praet.org> X-Mailer: git-send-email 1.7.8.1 In-Reply-To: <1329683908-5435-5-git-send-email-pieter@praet.org> References: <1329683908-5435-5-git-send-email-pieter@praet.org> X-Gm-Message-State: ALoCoQkOvS/Tdv+UntzOHTLjOT7IL42tbL47E+MeBwtu2qpeKsXQkEYTcb1yPAfgbQ56jQaAm9bc 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:50 -0000 `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. --- test/emacs | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-) diff --git a/test/emacs b/test/emacs index b74cfa9..d64dcd0 100755 --- a/test/emacs +++ b/test/emacs @@ -124,6 +124,44 @@ 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 >0 matches!" +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" + + 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