1 Return-Path: <pieter@praet.org>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 2AAB6431FB6
\r
6 for <notmuch@notmuchmail.org>; Wed, 7 Mar 2012 11:50:02 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id 9o19+ACpI0p3 for <notmuch@notmuchmail.org>;
\r
16 Wed, 7 Mar 2012 11:50:01 -0800 (PST)
\r
17 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com
\r
18 [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 36CE1431FAE
\r
21 for <notmuch@notmuchmail.org>; Wed, 7 Mar 2012 11:50:01 -0800 (PST)
\r
22 Received: by wico1 with SMTP id o1so3651639wic.26
\r
23 for <notmuch@notmuchmail.org>; Wed, 07 Mar 2012 11:49:59 -0800 (PST)
\r
24 Received: by 10.180.24.66 with SMTP id s2mr6535472wif.7.1331149799876;
\r
25 Wed, 07 Mar 2012 11:49:59 -0800 (PST)
\r
26 Received: from localhost ([109.131.36.23])
\r
27 by mx.google.com with ESMTPS id w14sm25260363wiv.11.2012.03.07.11.49.57
\r
28 (version=TLSv1/SSLv3 cipher=OTHER);
\r
29 Wed, 07 Mar 2012 11:49:58 -0800 (PST)
\r
30 From: Pieter Praet <pieter@praet.org>
\r
31 To: Notmuch Mail <notmuch@notmuchmail.org>
\r
32 Subject: [PATCH v4] test: emacs: new test "notmuch-search: change tags of all
\r
34 Date: Wed, 7 Mar 2012 20:49:52 +0100
\r
35 Message-Id: <1331149792-17192-1-git-send-email-pieter@praet.org>
\r
36 X-Mailer: git-send-email 1.7.8.1
\r
37 In-Reply-To: <1329936867-923-1-git-send-email-pieter@praet.org>
\r
38 References: <1329936867-923-1-git-send-email-pieter@praet.org>
\r
40 ALoCoQkFbtqP3CmQBa+G1G5DLiEht/C+Q95mv+jWWAMM04L6JaRATLRZsPeKq1KAh6PB6YA1inY4
\r
41 X-BeenThere: notmuch@notmuchmail.org
\r
42 X-Mailman-Version: 2.1.13
\r
44 List-Id: "Use and development of the notmuch mail system."
\r
45 <notmuch.notmuchmail.org>
\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
47 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
49 List-Post: <mailto:notmuch@notmuchmail.org>
\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
52 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
53 X-List-Received-Date: Wed, 07 Mar 2012 19:50:02 -0000
\r
55 * test/emacs-search:
\r
57 - New subtest "notmuch-search: change tags of all matching messages":
\r
58 `notmuch-search-tag-all' (bound to "*") adds and removes tags
\r
59 to/from all messages which match the query used to populate the
\r
60 current search buffer.
\r
63 Moved to a separate file to prevent a merge conflict when applied in
\r
64 conjunction with the patches listed @ id:"877gz4dnl2.fsf@praet.org".
\r
67 test/emacs-search | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
\r
68 test/notmuch-test | 1 +
\r
69 2 files changed, 49 insertions(+), 0 deletions(-)
\r
70 create mode 100755 test/emacs-search
\r
72 diff --git a/test/emacs-search b/test/emacs-search
\r
73 new file mode 100755
\r
74 index 0000000..1cd8a89
\r
76 +++ b/test/emacs-search
\r
78 +#!/usr/bin/env bash
\r
80 +test_description="Emacs notmuch-search-mode"
\r
83 +EXPECTED=$TEST_DIRECTORY/emacs-show.expected-output
\r
88 +test_begin_subtest "notmuch-search: change tags of all matching messages"
\r
91 +filter="AND from:cworth"
\r
93 +# Get initial tag counts and prevent false positives/negatives
\r
94 +old_tag_count_1=$(notmuch count tag:"${old_tag}" "${filter}")
\r
95 +new_tag_count_1=$(notmuch count tag:"${new_tag}" "${filter}")
\r
96 +test "${old_tag_count_1}" = "0" && old_tag_count_1="Need >0 matches!"
\r
97 +test "${new_tag_count_1}" = "0" || new_tag_count_1="Need 0 matches!"
\r
99 +# Change tags of all matching messages and get tag counts
\r
100 +test_emacs "(notmuch-search \"tag:${old_tag} ${filter}\")
\r
101 + (notmuch-test-wait)
\r
102 + (notmuch-search-tag-all \"-${old_tag}\" \"+${new_tag}\")"
\r
103 +old_tag_count_2=$(notmuch count tag:"${old_tag}" "${filter}")
\r
104 +new_tag_count_2=$(notmuch count tag:"${new_tag}" "${filter}")
\r
106 +# Revert tag changes and get tag counts
\r
107 +test_emacs "(notmuch-search \"tag:${new_tag} ${filter}\")
\r
108 + (notmuch-test-wait)
\r
109 + (notmuch-search-tag-all \"+${old_tag}\" \"-${new_tag}\")"
\r
110 +old_tag_count_3=$(notmuch count tag:"${old_tag}" "${filter}")
\r
111 +new_tag_count_3=$(notmuch count tag:"${new_tag}" "${filter}")
\r
113 +# ... and verify the results
\r
115 +before: old:${old_tag_count_1} new:${new_tag_count_1}
\r
116 +after: old:${old_tag_count_2} new:${new_tag_count_2}
\r
117 +restored: old:${old_tag_count_3} new:${new_tag_count_3}"
\r
119 +before: old:${old_tag_count_1} new:0
\r
120 +after: old:0 new:${old_tag_count_1}
\r
121 +restored: old:${old_tag_count_1} new:0"
\r
122 +test_expect_equal "$output" "$expected"
\r
126 diff --git a/test/notmuch-test b/test/notmuch-test
\r
127 index e14d34e..81d0d7f 100755
\r
128 --- a/test/notmuch-test
\r
129 +++ b/test/notmuch-test
\r
130 @@ -54,6 +54,7 @@ TESTS="
\r
132 emacs-test-functions
\r
133 emacs-address-cleaning
\r
137 TESTS=${NOTMUCH_TESTS:=$TESTS}
\r