[PATCH v2 4/4] test: emacs: new test "notmuch-search: change tags of all matching...
authorPieter Praet <pieter@praet.org>
Sun, 19 Feb 2012 20:38:28 +0000 (21:38 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:44:42 +0000 (09:44 -0800)
17/dd828385494875f4c4957cfa1af1d18f115a49 [new file with mode: 0644]

diff --git a/17/dd828385494875f4c4957cfa1af1d18f115a49 b/17/dd828385494875f4c4957cfa1af1d18f115a49
new file mode 100644 (file)
index 0000000..273a99f
--- /dev/null
@@ -0,0 +1,119 @@
+Return-Path: <pieter@praet.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id A9951431FC2\r
+       for <notmuch@notmuchmail.org>; Sun, 19 Feb 2012 12:41:28 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id PnpebOEVtq7O for <notmuch@notmuchmail.org>;\r
+       Sun, 19 Feb 2012 12:41:26 -0800 (PST)\r
+Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com\r
+ [74.125.82.45])       (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
+ certificate requested)        by olra.theworths.org (Postfix) with ESMTPS id\r
+ F0552431FD2   for <notmuch@notmuchmail.org>; Sun, 19 Feb 2012 12:41:17 -0800\r
+ (PST)\r
+Received: by mail-ww0-f45.google.com with SMTP id dt12so4004483wgb.2\r
+       for <notmuch@notmuchmail.org>; Sun, 19 Feb 2012 12:41:17 -0800 (PST)\r
+Received-SPF: pass (google.com: domain of pieter@praet.org designates\r
+       10.180.81.66 as permitted sender) client-ip=10.180.81.66; \r
+Authentication-Results: mr.google.com;\r
+       spf=pass (google.com: domain of pieter@praet.org\r
+       designates 10.180.81.66 as permitted sender)\r
+       smtp.mail=pieter@praet.org\r
+Received: from mr.google.com ([10.180.81.66])\r
+       by 10.180.81.66 with SMTP id y2mr11771988wix.20.1329684077644 (num_hops\r
+       = 1); Sun, 19 Feb 2012 12:41:17 -0800 (PST)\r
+MIME-Version: 1.0\r
+Received: by 10.180.81.66 with SMTP id y2mr9848694wix.20.1329684077592;\r
+       Sun, 19 Feb 2012 12:41:17 -0800 (PST)\r
+Received: from localhost (104.218-242-81.adsl-dyn.isp.belgacom.be.\r
+       [81.242.218.104])\r
+       by mx.google.com with ESMTPS id h19sm11370840wiw.9.2012.02.19.12.41.16\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Sun, 19 Feb 2012 12:41:17 -0800 (PST)\r
+From: Pieter Praet <pieter@praet.org>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH v2 4/4] test: emacs: new test "notmuch-search: change tags of\r
+       all matching messages"\r
+Date: Sun, 19 Feb 2012 21:38:28 +0100\r
+Message-Id: <1329683908-5435-5-git-send-email-pieter@praet.org>\r
+X-Mailer: git-send-email 1.7.8.1\r
+In-Reply-To: <1329683908-5435-1-git-send-email-pieter@praet.org>\r
+References: <1310313335-4159-1-git-send-email-pieter@praet.org>\r
+       <1329683908-5435-1-git-send-email-pieter@praet.org>\r
+X-Gm-Message-State:\r
+ ALoCoQm4gs+0vHgx2SlF310Glipuh8xlcFuestAyxrJKUk8ySJwfOTuN6F6U2piIbONlPrJH1IAK\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 19 Feb 2012 20:41:29 -0000\r
+\r
+`notmuch-search-tag-all' (bound to "*") adds and removes tags\r
+to/from all messages which match the query used to populate the\r
+current search buffer.\r
+---\r
+ test/emacs |   32 ++++++++++++++++++++++++++++++++\r
+ 1 files changed, 32 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/test/emacs b/test/emacs\r
+index b0fb760..1db8540 100755\r
+--- a/test/emacs\r
++++ b/test/emacs\r
+@@ -124,6 +124,38 @@ test_emacs "(notmuch-show \"$os_x_darwin_thread\")\r
+ output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)\r
+ 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)"\r
+ \r
++test_begin_subtest "notmuch-search: change tags of all matching messages"\r
++old_tag="inbox"\r
++new_tag="xobni"\r
++filter="AND from:cworth"\r
++# Get initial tag counts and prevent false positives/negatives\r
++old_tag_count_1=$(notmuch count tag:"${old_tag}" "${filter}")\r
++new_tag_count_1=$(notmuch count tag:"${new_tag}" "${filter}")\r
++test "${old_tag_count_1}" == "0" && old_tag_count_1="Need 1+ matches!"\r
++test "${new_tag_count_1}" == "0" || new_tag_count_1="Need 0 matches!"\r
++# Change tags of all matching messages and get tag counts\r
++test_emacs "(notmuch-search \"tag:${old_tag} ${filter}\")\r
++          (notmuch-test-wait)\r
++          (notmuch-search-tag-all \"-${old_tag}\" \"+${new_tag}\")"\r
++old_tag_count_2=$(notmuch count tag:"${old_tag}" "${filter}")\r
++new_tag_count_2=$(notmuch count tag:"${new_tag}" "${filter}")\r
++# Revert tag changes and get tag counts\r
++test_emacs "(notmuch-search \"tag:${new_tag} ${filter}\")\r
++          (notmuch-test-wait)\r
++          (notmuch-search-tag-all \"+${old_tag}\" \"-${new_tag}\")"\r
++old_tag_count_3=$(notmuch count tag:"${old_tag}" "${filter}")\r
++new_tag_count_3=$(notmuch count tag:"${new_tag}" "${filter}")\r
++# ... and verify the results\r
++output="\r
++before:   old:${old_tag_count_1} new:${new_tag_count_1}\r
++after:    old:${old_tag_count_2} new:${new_tag_count_2}\r
++restored: old:${old_tag_count_3} new:${new_tag_count_3}"\r
++expected="\r
++before:   old:${old_tag_count_1} new:0\r
++after:    old:0 new:${old_tag_count_1}\r
++restored: old:${old_tag_count_1} new:0"\r
++test_expect_equal "$output" "$expected"\r
++\r
+ test_begin_subtest "Message with .. in Message-Id:"\r
+ add_message [id]=123..456@example '[subject]="Message with .. in Message-Id"'\r
+ test_emacs '(notmuch-search "id:\"123..456@example\"")\r
+-- \r
+1.7.8.1\r
+\r