From 44e116a71e1c0afb35b617d51efad0bcc8a79d48 Mon Sep 17 00:00:00 2001 From: Pieter Praet Date: Sun, 19 Feb 2012 21:38:28 +0100 Subject: [PATCH] [PATCH v2 4/4] test: emacs: new test "notmuch-search: change tags of all matching messages" --- 17/dd828385494875f4c4957cfa1af1d18f115a49 | 119 ++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 17/dd828385494875f4c4957cfa1af1d18f115a49 diff --git a/17/dd828385494875f4c4957cfa1af1d18f115a49 b/17/dd828385494875f4c4957cfa1af1d18f115a49 new file mode 100644 index 000000000..273a99f86 --- /dev/null +++ b/17/dd828385494875f4c4957cfa1af1d18f115a49 @@ -0,0 +1,119 @@ +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 A9951431FC2 + for ; Sun, 19 Feb 2012 12:41:28 -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 PnpebOEVtq7O for ; + Sun, 19 Feb 2012 12:41:26 -0800 (PST) +Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com + [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + F0552431FD2 for ; Sun, 19 Feb 2012 12:41:17 -0800 + (PST) +Received: by mail-ww0-f45.google.com with SMTP id dt12so4004483wgb.2 + for ; Sun, 19 Feb 2012 12:41:17 -0800 (PST) +Received-SPF: pass (google.com: domain of pieter@praet.org designates + 10.180.81.66 as permitted sender) client-ip=10.180.81.66; +Authentication-Results: mr.google.com; + spf=pass (google.com: domain of pieter@praet.org + designates 10.180.81.66 as permitted sender) + smtp.mail=pieter@praet.org +Received: from mr.google.com ([10.180.81.66]) + by 10.180.81.66 with SMTP id y2mr11771988wix.20.1329684077644 (num_hops + = 1); Sun, 19 Feb 2012 12:41:17 -0800 (PST) +MIME-Version: 1.0 +Received: by 10.180.81.66 with SMTP id y2mr9848694wix.20.1329684077592; + Sun, 19 Feb 2012 12:41:17 -0800 (PST) +Received: from localhost (104.218-242-81.adsl-dyn.isp.belgacom.be. + [81.242.218.104]) + by mx.google.com with ESMTPS id h19sm11370840wiw.9.2012.02.19.12.41.16 + (version=TLSv1/SSLv3 cipher=OTHER); + Sun, 19 Feb 2012 12:41:17 -0800 (PST) +From: Pieter Praet +To: Notmuch Mail +Subject: [PATCH v2 4/4] test: emacs: new test "notmuch-search: change tags of + all matching messages" +Date: Sun, 19 Feb 2012 21:38:28 +0100 +Message-Id: <1329683908-5435-5-git-send-email-pieter@praet.org> +X-Mailer: git-send-email 1.7.8.1 +In-Reply-To: <1329683908-5435-1-git-send-email-pieter@praet.org> +References: <1310313335-4159-1-git-send-email-pieter@praet.org> + <1329683908-5435-1-git-send-email-pieter@praet.org> +X-Gm-Message-State: + ALoCoQm4gs+0vHgx2SlF310Glipuh8xlcFuestAyxrJKUk8ySJwfOTuN6F6U2piIbONlPrJH1IAK +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, 19 Feb 2012 20:41:29 -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 | 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!" ++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 + -- 2.26.2