Re: [PATCH v3] nmbug: Translate to Python
[notmuch-archives.git] / 17 / dd828385494875f4c4957cfa1af1d18f115a49
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 A9951431FC2\r
6         for <notmuch@notmuchmail.org>; Sun, 19 Feb 2012 12:41:28 -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 PnpebOEVtq7O for <notmuch@notmuchmail.org>;\r
16         Sun, 19 Feb 2012 12:41:26 -0800 (PST)\r
17 Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com\r
18  [74.125.82.45])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
19  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
20  F0552431FD2    for <notmuch@notmuchmail.org>; Sun, 19 Feb 2012 12:41:17 -0800\r
21  (PST)\r
22 Received: by mail-ww0-f45.google.com with SMTP id dt12so4004483wgb.2\r
23         for <notmuch@notmuchmail.org>; Sun, 19 Feb 2012 12:41:17 -0800 (PST)\r
24 Received-SPF: pass (google.com: domain of pieter@praet.org designates\r
25         10.180.81.66 as permitted sender) client-ip=10.180.81.66; \r
26 Authentication-Results: mr.google.com;\r
27         spf=pass (google.com: domain of pieter@praet.org\r
28         designates 10.180.81.66 as permitted sender)\r
29         smtp.mail=pieter@praet.org\r
30 Received: from mr.google.com ([10.180.81.66])\r
31         by 10.180.81.66 with SMTP id y2mr11771988wix.20.1329684077644 (num_hops\r
32         = 1); Sun, 19 Feb 2012 12:41:17 -0800 (PST)\r
33 MIME-Version: 1.0\r
34 Received: by 10.180.81.66 with SMTP id y2mr9848694wix.20.1329684077592;\r
35         Sun, 19 Feb 2012 12:41:17 -0800 (PST)\r
36 Received: from localhost (104.218-242-81.adsl-dyn.isp.belgacom.be.\r
37         [81.242.218.104])\r
38         by mx.google.com with ESMTPS id h19sm11370840wiw.9.2012.02.19.12.41.16\r
39         (version=TLSv1/SSLv3 cipher=OTHER);\r
40         Sun, 19 Feb 2012 12:41:17 -0800 (PST)\r
41 From: Pieter Praet <pieter@praet.org>\r
42 To: Notmuch Mail <notmuch@notmuchmail.org>\r
43 Subject: [PATCH v2 4/4] test: emacs: new test "notmuch-search: change tags of\r
44         all matching messages"\r
45 Date: Sun, 19 Feb 2012 21:38:28 +0100\r
46 Message-Id: <1329683908-5435-5-git-send-email-pieter@praet.org>\r
47 X-Mailer: git-send-email 1.7.8.1\r
48 In-Reply-To: <1329683908-5435-1-git-send-email-pieter@praet.org>\r
49 References: <1310313335-4159-1-git-send-email-pieter@praet.org>\r
50         <1329683908-5435-1-git-send-email-pieter@praet.org>\r
51 X-Gm-Message-State:\r
52  ALoCoQm4gs+0vHgx2SlF310Glipuh8xlcFuestAyxrJKUk8ySJwfOTuN6F6U2piIbONlPrJH1IAK\r
53 X-BeenThere: notmuch@notmuchmail.org\r
54 X-Mailman-Version: 2.1.13\r
55 Precedence: list\r
56 List-Id: "Use and development of the notmuch mail system."\r
57         <notmuch.notmuchmail.org>\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
61 List-Post: <mailto:notmuch@notmuchmail.org>\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
65 X-List-Received-Date: Sun, 19 Feb 2012 20:41:29 -0000\r
66 \r
67 `notmuch-search-tag-all' (bound to "*") adds and removes tags\r
68 to/from all messages which match the query used to populate the\r
69 current search buffer.\r
70 ---\r
71  test/emacs |   32 ++++++++++++++++++++++++++++++++\r
72  1 files changed, 32 insertions(+), 0 deletions(-)\r
73 \r
74 diff --git a/test/emacs b/test/emacs\r
75 index b0fb760..1db8540 100755\r
76 --- a/test/emacs\r
77 +++ b/test/emacs\r
78 @@ -124,6 +124,38 @@ test_emacs "(notmuch-show \"$os_x_darwin_thread\")\r
79  output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)\r
80  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
81  \r
82 +test_begin_subtest "notmuch-search: change tags of all matching messages"\r
83 +old_tag="inbox"\r
84 +new_tag="xobni"\r
85 +filter="AND from:cworth"\r
86 +# Get initial tag counts and prevent false positives/negatives\r
87 +old_tag_count_1=$(notmuch count tag:"${old_tag}" "${filter}")\r
88 +new_tag_count_1=$(notmuch count tag:"${new_tag}" "${filter}")\r
89 +test "${old_tag_count_1}" == "0" && old_tag_count_1="Need 1+ matches!"\r
90 +test "${new_tag_count_1}" == "0" || new_tag_count_1="Need 0 matches!"\r
91 +# Change tags of all matching messages and get tag counts\r
92 +test_emacs "(notmuch-search \"tag:${old_tag} ${filter}\")\r
93 +           (notmuch-test-wait)\r
94 +           (notmuch-search-tag-all \"-${old_tag}\" \"+${new_tag}\")"\r
95 +old_tag_count_2=$(notmuch count tag:"${old_tag}" "${filter}")\r
96 +new_tag_count_2=$(notmuch count tag:"${new_tag}" "${filter}")\r
97 +# Revert tag changes and get tag counts\r
98 +test_emacs "(notmuch-search \"tag:${new_tag} ${filter}\")\r
99 +           (notmuch-test-wait)\r
100 +           (notmuch-search-tag-all \"+${old_tag}\" \"-${new_tag}\")"\r
101 +old_tag_count_3=$(notmuch count tag:"${old_tag}" "${filter}")\r
102 +new_tag_count_3=$(notmuch count tag:"${new_tag}" "${filter}")\r
103 +# ... and verify the results\r
104 +output="\r
105 +before:   old:${old_tag_count_1} new:${new_tag_count_1}\r
106 +after:    old:${old_tag_count_2} new:${new_tag_count_2}\r
107 +restored: old:${old_tag_count_3} new:${new_tag_count_3}"\r
108 +expected="\r
109 +before:   old:${old_tag_count_1} new:0\r
110 +after:    old:0 new:${old_tag_count_1}\r
111 +restored: old:${old_tag_count_1} new:0"\r
112 +test_expect_equal "$output" "$expected"\r
113 +\r
114  test_begin_subtest "Message with .. in Message-Id:"\r
115  add_message [id]=123..456@example '[subject]="Message with .. in Message-Id"'\r
116  test_emacs '(notmuch-search "id:\"123..456@example\"")\r
117 -- \r
118 1.7.8.1\r
119 \r