[PATCH v4] test: emacs: new test "notmuch-search: change tags of all matching messages"
authorPieter Praet <pieter@praet.org>
Wed, 7 Mar 2012 19:49:52 +0000 (20:49 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:45:17 +0000 (09:45 -0800)
e8/97bc3d87fe5fc4fd46cbfbb161244e472c8dc3 [new file with mode: 0644]

diff --git a/e8/97bc3d87fe5fc4fd46cbfbb161244e472c8dc3 b/e8/97bc3d87fe5fc4fd46cbfbb161244e472c8dc3
new file mode 100644 (file)
index 0000000..ea5d6f7
--- /dev/null
@@ -0,0 +1,140 @@
+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 2AAB6431FB6\r
+       for <notmuch@notmuchmail.org>; Wed,  7 Mar 2012 11:50:02 -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 9o19+ACpI0p3 for <notmuch@notmuchmail.org>;\r
+       Wed,  7 Mar 2012 11:50:01 -0800 (PST)\r
+Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
+       [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 36CE1431FAE\r
+       for <notmuch@notmuchmail.org>; Wed,  7 Mar 2012 11:50:01 -0800 (PST)\r
+Received: by wico1 with SMTP id o1so3651639wic.26\r
+       for <notmuch@notmuchmail.org>; Wed, 07 Mar 2012 11:49:59 -0800 (PST)\r
+Received: by 10.180.24.66 with SMTP id s2mr6535472wif.7.1331149799876;\r
+       Wed, 07 Mar 2012 11:49:59 -0800 (PST)\r
+Received: from localhost ([109.131.36.23])\r
+       by mx.google.com with ESMTPS id w14sm25260363wiv.11.2012.03.07.11.49.57\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Wed, 07 Mar 2012 11:49:58 -0800 (PST)\r
+From: Pieter Praet <pieter@praet.org>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH v4] test: emacs: new test "notmuch-search: change tags of all\r
+       matching messages"\r
+Date: Wed,  7 Mar 2012 20:49:52 +0100\r
+Message-Id: <1331149792-17192-1-git-send-email-pieter@praet.org>\r
+X-Mailer: git-send-email 1.7.8.1\r
+In-Reply-To: <1329936867-923-1-git-send-email-pieter@praet.org>\r
+References: <1329936867-923-1-git-send-email-pieter@praet.org>\r
+X-Gm-Message-State:\r
+ ALoCoQkFbtqP3CmQBa+G1G5DLiEht/C+Q95mv+jWWAMM04L6JaRATLRZsPeKq1KAh6PB6YA1inY4\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: Wed, 07 Mar 2012 19:50:02 -0000\r
+\r
+* test/emacs-search:\r
+\r
+  - New subtest "notmuch-search: change tags of all matching messages":\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
+\r
+Moved to a separate file to prevent a merge conflict when applied in\r
+conjunction with the patches listed @ id:"877gz4dnl2.fsf@praet.org".\r
+\r
+\r
+ test/emacs-search |   48 ++++++++++++++++++++++++++++++++++++++++++++++++\r
+ test/notmuch-test |    1 +\r
+ 2 files changed, 49 insertions(+), 0 deletions(-)\r
+ create mode 100755 test/emacs-search\r
+\r
+diff --git a/test/emacs-search b/test/emacs-search\r
+new file mode 100755\r
+index 0000000..1cd8a89\r
+--- /dev/null\r
++++ b/test/emacs-search\r
+@@ -0,0 +1,48 @@\r
++#!/usr/bin/env bash\r
++\r
++test_description="Emacs notmuch-search-mode"\r
++. test-lib.sh\r
++\r
++EXPECTED=$TEST_DIRECTORY/emacs-show.expected-output\r
++\r
++add_email_corpus\r
++\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
++\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 >0 matches!"\r
++test "${new_tag_count_1}" = "0" || new_tag_count_1="Need 0 matches!"\r
++\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
++\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
++\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
++\r
++test_done\r
+diff --git a/test/notmuch-test b/test/notmuch-test\r
+index e14d34e..81d0d7f 100755\r
+--- a/test/notmuch-test\r
++++ b/test/notmuch-test\r
+@@ -54,6 +54,7 @@ TESTS="\r
+   argument-parsing\r
+   emacs-test-functions\r
+   emacs-address-cleaning\r
++  emacs-search\r
+   emacs-show\r
+ "\r
+ TESTS=${NOTMUCH_TESTS:=$TESTS}\r
+-- \r
+1.7.8.1\r
+\r