Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / e8 / 97bc3d87fe5fc4fd46cbfbb161244e472c8dc3
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
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \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
33         matching messages"\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
39 X-Gm-Message-State:\r
40  ALoCoQkFbtqP3CmQBa+G1G5DLiEht/C+Q95mv+jWWAMM04L6JaRATLRZsPeKq1KAh6PB6YA1inY4\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.13\r
43 Precedence: list\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
54 \r
55 * test/emacs-search:\r
56 \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
61 ---\r
62 \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
65 \r
66 \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
71 \r
72 diff --git a/test/emacs-search b/test/emacs-search\r
73 new file mode 100755\r
74 index 0000000..1cd8a89\r
75 --- /dev/null\r
76 +++ b/test/emacs-search\r
77 @@ -0,0 +1,48 @@\r
78 +#!/usr/bin/env bash\r
79 +\r
80 +test_description="Emacs notmuch-search-mode"\r
81 +. test-lib.sh\r
82 +\r
83 +EXPECTED=$TEST_DIRECTORY/emacs-show.expected-output\r
84 +\r
85 +add_email_corpus\r
86 +\r
87 +\r
88 +test_begin_subtest "notmuch-search: change tags of all matching messages"\r
89 +old_tag="inbox"\r
90 +new_tag="xobni"\r
91 +filter="AND from:cworth"\r
92 +\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
98 +\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
105 +\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
112 +\r
113 +# ... and verify the results\r
114 +output="\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
118 +expected="\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
123 +\r
124 +\r
125 +test_done\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
131    argument-parsing\r
132    emacs-test-functions\r
133    emacs-address-cleaning\r
134 +  emacs-search\r
135    emacs-show\r
136  "\r
137  TESTS=${NOTMUCH_TESTS:=$TESTS}\r
138 -- \r
139 1.7.8.1\r
140 \r