Re: Flat search and threaded views
[notmuch-archives.git] / 35 / 6bed616e4e72768da8f985292fa6b90ad1fc5e
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 B72F3431FB6\r
6         for <notmuch@notmuchmail.org>; Wed, 22 Feb 2012 10:56:50 -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 Rfxo5Va9eIvv for <notmuch@notmuchmail.org>;\r
16         Wed, 22 Feb 2012 10:56:43 -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 6B8DA431FAE\r
21         for <notmuch@notmuchmail.org>; Wed, 22 Feb 2012 10:56:43 -0800 (PST)\r
22 Received: by mail-wi0-f181.google.com with SMTP id hi8so278196wib.26\r
23         for <notmuch@notmuchmail.org>; Wed, 22 Feb 2012 10:56:43 -0800 (PST)\r
24 Received-SPF: pass (google.com: domain of pieter@praet.org designates\r
25         10.216.131.23 as permitted sender) client-ip=10.216.131.23; \r
26 Authentication-Results: mr.google.com;\r
27         spf=pass (google.com: domain of pieter@praet.org\r
28         designates 10.216.131.23 as permitted sender)\r
29         smtp.mail=pieter@praet.org\r
30 Received: from mr.google.com ([10.216.131.23])\r
31         by 10.216.131.23 with SMTP id l23mr9740227wei.37.1329937003289\r
32         (num_hops = 1); Wed, 22 Feb 2012 10:56:43 -0800 (PST)\r
33 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
34         d=google.com; s=gamma;\r
35         h=mime-version:from:to:subject:date:message-id:x-mailer:in-reply-to\r
36         :references:x-gm-message-state;\r
37         bh=nyuJ3PKTjHS4QQeEC9Sl2X23ILZAhndliN5bhky3WQk=;\r
38         b=lH1mNReCtiR6HR0P2lY199xjgLvN5YAd2XUjfmUaIKS18Kuy6a/O/kD+FrkCA0C13+\r
39         kIkX1BwohIHbfEpsBAxYMwQncJ1hBZdTxxpg/dc/eF+7nIb5PZirlUMyZC61qMY5rFQf\r
40         alktoPo6gWloCD1B5I+vRXChuAO56JRvTnMAg=\r
41 MIME-Version: 1.0\r
42 Received: by 10.216.131.23 with SMTP id l23mr8044182wei.37.1329937003123;\r
43         Wed, 22 Feb 2012 10:56:43 -0800 (PST)\r
44 Received: from localhost ([109.131.181.26])\r
45         by mx.google.com with ESMTPS id n5sm74947151wiw.7.2012.02.22.10.56.42\r
46         (version=TLSv1/SSLv3 cipher=OTHER);\r
47         Wed, 22 Feb 2012 10:56:42 -0800 (PST)\r
48 From: Pieter Praet <pieter@praet.org>\r
49 To: Notmuch Mail <notmuch@notmuchmail.org>\r
50 Subject: [PATCH v3] test: emacs: new test "notmuch-search: change tags of all\r
51         matching messages"\r
52 Date: Wed, 22 Feb 2012 19:54:27 +0100\r
53 Message-Id: <1329936867-923-1-git-send-email-pieter@praet.org>\r
54 X-Mailer: git-send-email 1.7.8.1\r
55 In-Reply-To: <1329683908-5435-5-git-send-email-pieter@praet.org>\r
56 References: <1329683908-5435-5-git-send-email-pieter@praet.org>\r
57 X-Gm-Message-State:\r
58  ALoCoQkOvS/Tdv+UntzOHTLjOT7IL42tbL47E+MeBwtu2qpeKsXQkEYTcb1yPAfgbQ56jQaAm9bc\r
59 X-BeenThere: notmuch@notmuchmail.org\r
60 X-Mailman-Version: 2.1.13\r
61 Precedence: list\r
62 List-Id: "Use and development of the notmuch mail system."\r
63         <notmuch.notmuchmail.org>\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
65         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
67 List-Post: <mailto:notmuch@notmuchmail.org>\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
71 X-List-Received-Date: Wed, 22 Feb 2012 18:56:50 -0000\r
72 \r
73 `notmuch-search-tag-all' (bound to "*") adds and removes tags\r
74 to/from all messages which match the query used to populate the\r
75 current search buffer.\r
76 ---\r
77  test/emacs |   38 ++++++++++++++++++++++++++++++++++++++\r
78  1 files changed, 38 insertions(+), 0 deletions(-)\r
79 \r
80 diff --git a/test/emacs b/test/emacs\r
81 index b74cfa9..d64dcd0 100755\r
82 --- a/test/emacs\r
83 +++ b/test/emacs\r
84 @@ -124,6 +124,44 @@ test_emacs "(notmuch-show \"$os_x_darwin_thread\")\r
85  output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)\r
86  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
87  \r
88 +\r
89 +test_begin_subtest "notmuch-search: change tags of all matching messages"\r
90 +old_tag="inbox"\r
91 +new_tag="xobni"\r
92 +filter="AND from:cworth"\r
93 +\r
94 +# Get initial tag counts and prevent false positives/negatives\r
95 +old_tag_count_1=$(notmuch count tag:"${old_tag}" "${filter}")\r
96 +new_tag_count_1=$(notmuch count tag:"${new_tag}" "${filter}")\r
97 +test "${old_tag_count_1}" = "0" && old_tag_count_1="Need >0 matches!"\r
98 +test "${new_tag_count_1}" = "0" || new_tag_count_1="Need 0 matches!"\r
99 +\r
100 +# Change tags of all matching messages and get tag counts\r
101 +test_emacs "(notmuch-search \"tag:${old_tag} ${filter}\")\r
102 +           (notmuch-test-wait)\r
103 +           (notmuch-search-tag-all \"-${old_tag}\" \"+${new_tag}\")"\r
104 +old_tag_count_2=$(notmuch count tag:"${old_tag}" "${filter}")\r
105 +new_tag_count_2=$(notmuch count tag:"${new_tag}" "${filter}")\r
106 +\r
107 +# Revert tag changes and get tag counts\r
108 +test_emacs "(notmuch-search \"tag:${new_tag} ${filter}\")\r
109 +           (notmuch-test-wait)\r
110 +           (notmuch-search-tag-all \"+${old_tag}\" \"-${new_tag}\")"\r
111 +old_tag_count_3=$(notmuch count tag:"${old_tag}" "${filter}")\r
112 +new_tag_count_3=$(notmuch count tag:"${new_tag}" "${filter}")\r
113 +\r
114 +# ... and verify the results\r
115 +output="\r
116 +before:   old:${old_tag_count_1} new:${new_tag_count_1}\r
117 +after:    old:${old_tag_count_2} new:${new_tag_count_2}\r
118 +restored: old:${old_tag_count_3} new:${new_tag_count_3}"\r
119 +expected="\r
120 +before:   old:${old_tag_count_1} new:0\r
121 +after:    old:0 new:${old_tag_count_1}\r
122 +restored: old:${old_tag_count_1} new:0"\r
123 +test_expect_equal "$output" "$expected"\r
124 +\r
125 +\r
126  test_begin_subtest "Message with .. in Message-Id:"\r
127  add_message [id]=123..456@example '[subject]="Message with .. in Message-Id"'\r
128  test_emacs '(notmuch-search "id:\"123..456@example\"")\r
129 -- \r
130 1.7.8.1\r
131 \r