1 Return-Path: <damien.cassou@gmail.com>
\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 49276431FD9
\r
6 for <notmuch@notmuchmail.org>; Tue, 11 Dec 2012 01:00:54 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id Se9T5WwCEPYd for <notmuch@notmuchmail.org>;
\r
17 Tue, 11 Dec 2012 01:00:52 -0800 (PST)
\r
18 Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com
\r
19 [209.85.212.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 2855C431FBC
\r
22 for <notmuch@notmuchmail.org>; Tue, 11 Dec 2012 01:00:49 -0800 (PST)
\r
23 Received: by mail-wi0-f175.google.com with SMTP id hm11so1683809wib.2
\r
24 for <notmuch@notmuchmail.org>; Tue, 11 Dec 2012 01:00:48 -0800 (PST)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
26 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
\r
27 bh=G+VGizi1tQ4364bUXhifTFRcQFd5SU79EcR5yZzznpI=;
\r
28 b=JHfKaMWFmvM0DXcO7ZTfb5x53VwazB21T7BtjIXbtu7D/s8X3HnUIjaLGm0jW/OO6T
\r
29 GysU/G8TOMLfkbansyfMrmzklUR2+ZSO43bp8INTuRHrEVsLtzF2gshez7K5YsevsBq4
\r
30 OBQrqBlEtSBkN7K3qfLJZYWzWH10bgHZAfHO/7CQzHVFi/yLsxegAP6RX6y4yaPuVH1w
\r
31 5wl03usEfQXENP64W4g/2Fm+EIYODlYBcwf58rNHhwSex+FKtBzi5cZp9u956M6AUC11
\r
32 mH2jC3m22JKqsXNbp7HLs72EutJXXPrUgdLdRYeVCHyKOPUopBX28SXGxEcy1mstESC/
\r
34 Received: by 10.216.206.194 with SMTP id l44mr339594weo.125.1355216448868;
\r
35 Tue, 11 Dec 2012 01:00:48 -0800 (PST)
\r
36 Received: from luz3.lille.inria.fr ([193.51.236.232])
\r
37 by mx.google.com with ESMTPS id b1sm15376748wix.11.2012.12.11.01.00.47
\r
38 (version=TLSv1/SSLv3 cipher=OTHER);
\r
39 Tue, 11 Dec 2012 01:00:48 -0800 (PST)
\r
40 From: Damien Cassou <damien.cassou@gmail.com>
\r
41 To: notmuch@notmuchmail.org
\r
42 Subject: [PATCH 4/4] emacs: Add unit-tests for clickable tags
\r
43 Date: Tue, 11 Dec 2012 10:00:37 +0100
\r
44 Message-Id: <1355216437-21109-5-git-send-email-damien.cassou@gmail.com>
\r
45 X-Mailer: git-send-email 1.7.10.4
\r
46 In-Reply-To: <1355216437-21109-1-git-send-email-damien.cassou@gmail.com>
\r
47 References: <1355216437-21109-1-git-send-email-damien.cassou@gmail.com>
\r
48 X-BeenThere: notmuch@notmuchmail.org
\r
49 X-Mailman-Version: 2.1.13
\r
51 List-Id: "Use and development of the notmuch mail system."
\r
52 <notmuch.notmuchmail.org>
\r
53 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
54 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
55 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
56 List-Post: <mailto:notmuch@notmuchmail.org>
\r
57 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
58 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
59 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
60 X-List-Received-Date: Tue, 11 Dec 2012 09:00:54 -0000
\r
62 Signed-off-by: Damien Cassou <damien.cassou@gmail.com>
\r
64 test/emacs | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\r
65 1 file changed, 103 insertions(+)
\r
67 diff --git a/test/emacs b/test/emacs
\r
68 index 4e941bb..b7c5a93 100755
\r
71 @@ -840,5 +840,108 @@ test_emacs "(let ((mm-text-html-renderer
\r
72 test_expect_success "Rendering HTML mail with images" \
\r
73 'cat OUTPUT && grep -q smiley OUTPUT'
\r
75 +test_begin_subtest "Extracting all tags from a thread"
\r
77 + '[subject]="Extracting all tags from a thread"' \
\r
79 +parent=${gen_msg_id}
\r
81 + '[subject]="Extracting all tags from a thread"' \
\r
82 + '[body]="body 2"' \
\r
83 + "[in-reply-to]=\<$parent\>"
\r
85 + '[subject]="Extracting all tags from a thread"' \
\r
86 + '[body]="body 3"' \
\r
87 + "[in-reply-to]=\<$parent\>"
\r
88 +latest=${gen_msg_id}
\r
89 +# Extract the thread-id from one of the emails
\r
90 +thread_id=$(notmuch search --output=threads id:${latest})
\r
91 +echo THREAD ID: '"'$thread_id'"'
\r
92 +# Add tag "mytagfoo" to one of the emails
\r
93 +notmuch tag +mytagfoo id:${latest}
\r
94 +test_emacs_expect_t \
\r
95 + "(notmuch-show \"${thread_id}\")
\r
96 + (let ((output (notmuch-show-thread-tags))
\r
97 + (expected '(\"inbox\" \"mytagfoo\" \"unread\")))
\r
98 + (notmuch-test-expect-equal
\r
99 + (sort output #'string<)
\r
100 + (sort expected #'string<)))"
\r
102 +test_begin_subtest "The tags appear in the header-line of notmuch-show"
\r
104 + '[subject]="foo bar"' \
\r
105 + '[body]="body 1"'
\r
106 +latest=${gen_msg_id}
\r
107 +# Add tag "mytagfoo" to one of the emails
\r
108 +notmuch tag +mytagfoo id:${latest}
\r
109 +# Extract the thread-id from one of the emails
\r
110 +thread_id=$(notmuch search --output=threads id:${latest})
\r
111 +test_emacs_expect_t \
\r
112 + "(notmuch-show \"${thread_id}\")
\r
113 + (if (string-match-p \"mytagfoo\" (format-mode-line header-line-format))
\r
115 + \"The tag 'mytagfoo' was not in the header-line-format\")"
\r
117 +test_begin_subtest "The tags appear in the header-line of notmuch-show even after update"
\r
119 + '[subject]="foo bar"' \
\r
120 + '[body]="body 1"'
\r
121 +latest=${gen_msg_id}
\r
122 +# Extract the thread-id from one of the emails
\r
123 +thread_id=$(notmuch search --output=threads id:${latest})
\r
124 +test_emacs_expect_t \
\r
125 + "(notmuch-show \"${thread_id}\")
\r
126 + (if (string-match-p \"mytagfoo\" (format-mode-line header-line-format))
\r
127 + (error \"There is no reason for 'mytagfoo' to be there.\"))
\r
128 + (notmuch-show-tag \"+mytagfoo\")
\r
129 + (if (string-match-p \"mytagfoo\" (format-mode-line header-line-format))
\r
131 + \"The tag 'mytagfoo' was not in the header-line-format\")"
\r
133 +test_begin_subtest "The tags of notmuch-show emails are clickable"
\r
135 + '[subject]="foo bar"' \
\r
136 + '[body]="body 1"'
\r
137 +latest=${gen_msg_id}
\r
138 +# Add tag "mytagfoo" to one of the emails
\r
139 +notmuch tag +mytagfoo id:${latest}
\r
140 +# Extract the thread-id from one of the emails
\r
141 +thread_id=$(notmuch search --output=threads id:${latest})
\r
142 +test_emacs_expect_t \
\r
143 + "(notmuch-show \"${thread_id}\")
\r
144 + (goto-char (point-min))
\r
145 + (re-search-forward \"mytagfoo\")
\r
146 + (backward-char) ;; to be 'in' the tag
\r
147 + (unless (eq major-mode 'notmuch-show-mode)
\r
148 + (error \"We must be in notmuch-show at this point but we are in %s.\" major-mode))
\r
149 + (push-button) ;; simulate a press on the RET key
\r
150 + (if (eq major-mode 'notmuch-search-mode)
\r
152 + (format \"We must be in notmuch-search at this point but we are in %s.\" major-mode))"
\r
154 +test_begin_subtest "The tags of notmuch-show emails are clickable even after update"
\r
156 + '[subject]="foo bar"' \
\r
157 + '[body]="body 1"'
\r
158 +latest=${gen_msg_id}
\r
159 +# Extract the thread-id from one of the emails
\r
160 +thread_id=$(notmuch search --output=threads id:${latest})
\r
161 +test_emacs_expect_t \
\r
162 + "(notmuch-show \"${thread_id}\")
\r
163 + (goto-char (point-min))
\r
164 + (if (re-search-forward \"mytagfoo\" nil t)
\r
165 + (error \"There is no reason for 'mytagfoo' to be there.\"))
\r
166 + (notmuch-show-tag \"+mytagfoo\")
\r
167 + (goto-char (point-min))
\r
168 + (unless (re-search-forward \"mytagfoo\" nil t)
\r
169 + (error \"The tag 'mytagfoo' must have been there.\"))
\r
170 + (backward-char) ;; to be 'in' the tag
\r
171 + (unless (eq major-mode 'notmuch-show-mode)
\r
172 + (error \"We must be in notmuch-show at this point but we are in %s.\" major-mode))
\r
173 + (push-button) ;; simulate a press on the RET key
\r
174 + (if (eq major-mode 'notmuch-search-mode)
\r
176 + (format \"We must be in notmuch-search at this point but we are in %s.\" major-mode))"
\r