1 Return-Path: <jani@nikula.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 D083C429E29
\r
6 for <notmuch@notmuchmail.org>; Sun, 25 Dec 2011 14:00:23 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"
\r
12 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
13 tests=[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 BRZThzZLFVfj for <notmuch@notmuchmail.org>;
\r
17 Sun, 25 Dec 2011 14:00:21 -0800 (PST)
\r
18 Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com
\r
19 [74.125.83.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
20 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
21 F2730429E2F for <notmuch@notmuchmail.org>; Sun, 25 Dec 2011 14:00:18 -0800
\r
23 Received: by mail-ee0-f53.google.com with SMTP id d41so12900601eek.26
\r
24 for <notmuch@notmuchmail.org>; Sun, 25 Dec 2011 14:00:18 -0800 (PST)
\r
25 Received: by 10.213.31.207 with SMTP id z15mr41279ebc.144.1324850418496;
\r
26 Sun, 25 Dec 2011 14:00:18 -0800 (PST)
\r
27 Received: from localhost (dsl-hkibrasgw4-fe5cdc00-23.dhcp.inet.fi.
\r
29 by mx.google.com with ESMTPS id b49sm51870237eec.9.2011.12.25.14.00.16
\r
30 (version=SSLv3 cipher=OTHER); Sun, 25 Dec 2011 14:00:17 -0800 (PST)
\r
31 From: Jani Nikula <jani@nikula.org>
\r
32 To: notmuch@notmuchmail.org
\r
33 Subject: [PATCH v2 2/2] test: emacs: test notmuch-wash-subject-to-* functions
\r
34 Date: Mon, 26 Dec 2011 00:00:06 +0200
\r
36 <311bcf81efbda645f3b436dd14300ccf5d53f1ff.1324849534.git.jani@nikula.org>
\r
37 X-Mailer: git-send-email 1.7.5.4
\r
38 In-Reply-To: <cover.1324849534.git.jani@nikula.org>
\r
39 References: <1321657368-13872-1-git-send-email-jani@nikula.org>
\r
40 <cover.1324849534.git.jani@nikula.org>
\r
41 In-Reply-To: <cover.1324849534.git.jani@nikula.org>
\r
42 References: <cover.1324849534.git.jani@nikula.org>
\r
44 Content-Type: text/plain; charset=UTF-8
\r
45 Content-Transfer-Encoding: 8bit
\r
46 X-BeenThere: notmuch@notmuchmail.org
\r
47 X-Mailman-Version: 2.1.13
\r
49 List-Id: "Use and development of the notmuch mail system."
\r
50 <notmuch.notmuchmail.org>
\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
52 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
54 List-Post: <mailto:notmuch@notmuchmail.org>
\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
57 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
58 X-List-Received-Date: Sun, 25 Dec 2011 22:00:24 -0000
\r
60 Signed-off-by: Jani Nikula <jani@nikula.org>
\r
62 test/emacs-subject-to-filename | 138 ++++++++++++++++++++++++++++++++++++++++
\r
63 test/notmuch-test | 1 +
\r
64 2 files changed, 139 insertions(+), 0 deletions(-)
\r
65 create mode 100755 test/emacs-subject-to-filename
\r
67 diff --git a/test/emacs-subject-to-filename b/test/emacs-subject-to-filename
\r
68 new file mode 100755
\r
69 index 0000000..176e685
\r
71 +++ b/test/emacs-subject-to-filename
\r
73 +#!/usr/bin/env bash
\r
75 +test_description="emacs: mail subject to filename"
\r
78 +# emacs server can't be started in a child process with $(test_emacs ...)
\r
79 +test_emacs '(ignore)'
\r
81 +# test notmuch-wash-subject-to-patch-sequence-number (subject)
\r
82 +test_begin_subtest "no patch sequence number"
\r
83 +output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number
\r
84 + "[PATCH] A normal patch subject without numbers")'
\r
86 +test_expect_equal "$output" ""
\r
88 +test_begin_subtest "patch sequence number #1"
\r
89 +output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number
\r
90 + "[PATCH 2/3] A most regular patch subject")'
\r
92 +test_expect_equal "$output" 2
\r
94 +test_begin_subtest "patch sequence number #2"
\r
95 +output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number
\r
96 + " [dummy list prefix] [RFC PATCH v2 13/42] Special prefixes")'
\r
98 +test_expect_equal "$output" 13
\r
100 +test_begin_subtest "patch sequence number #3"
\r
101 +output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number
\r
102 + "[PATCH 2/3] [PATCH 032/037] use the last prefix")'
\r
104 +test_expect_equal "$output" 32
\r
106 +test_begin_subtest "patch sequence number #4"
\r
107 +output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number
\r
108 + "[dummy list prefix] [PATCH 2/3] PATCH 3/3] do not use a broken prefix")'
\r
110 +test_expect_equal "$output" 2
\r
112 +test_begin_subtest "patch sequence number #5"
\r
113 +output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number
\r
114 + "[RFC][PATCH 3/5][PATCH 4/5][PATCH 5/5] A made up test")'
\r
116 +test_expect_equal "$output" 5
\r
118 +test_begin_subtest "patch sequence number #6"
\r
119 +output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number
\r
120 + "[PATCH 2/3] this -> [PATCH 3/3] is not a prefix anymore [nor this 4/4]")'
\r
122 +test_expect_equal "$output" 2
\r
124 +test_begin_subtest "patch sequence number #7"
\r
125 +output=$(test_emacs '(notmuch-wash-subject-to-patch-sequence-number
\r
126 + "[liberally accept crapola right before123/456and after] the numbers")'
\r
128 +test_expect_equal "$output" 123
\r
130 +# test notmuch-wash-subject-to-filename (subject &optional maxlen)
\r
131 +test_begin_subtest "filename #1"
\r
132 +output=$(test_emacs '(notmuch-wash-subject-to-filename
\r
133 + "just a subject line")'
\r
135 +test_expect_equal $output '"just-a-subject-line"'
\r
137 +test_begin_subtest "filename #2"
\r
138 +output=$(test_emacs '(notmuch-wash-subject-to-filename
\r
139 + " [any] [prefixes are ] [removed!] from the subject")'
\r
141 +test_expect_equal $output '"from-the-subject"'
\r
143 +test_begin_subtest "filename #3"
\r
144 +output=$(test_emacs '(notmuch-wash-subject-to-filename
\r
145 + " leading and trailing space ")'
\r
147 +test_expect_equal $output '"leading-and-trailing-space"'
\r
149 +test_begin_subtest "filename #4"
\r
150 +output=$(test_emacs '(notmuch-wash-subject-to-filename
\r
151 + "!# leading ()// &%, and in between_and_trailing garbage ()(&%%")'
\r
153 +test_expect_equal $output '"-leading-and-in-between_and_trailing-garbage"'
\r
155 +test_begin_subtest "filename #5"
\r
156 +output=$(test_emacs '(notmuch-wash-subject-to-filename
\r
157 + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_01234567890")'
\r
159 +test_expect_equal $output '"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_01234567890"'
\r
161 +test_begin_subtest "filename #6"
\r
162 +output=$(test_emacs '(notmuch-wash-subject-to-filename
\r
163 + "sequences of ... are squashed and trailing are removed ...")'
\r
165 +test_expect_equal $output '"sequences-of-.-are-squashed-and-trailing-are-removed"'
\r
167 +test_begin_subtest "filename #7"
\r
168 +output=$(test_emacs '(notmuch-wash-subject-to-filename
\r
169 + "max length test" 1)'
\r
171 +test_expect_equal $output '"m"'
\r
173 +test_begin_subtest "filename #8"
\r
174 +output=$(test_emacs '(notmuch-wash-subject-to-filename
\r
175 + "max length test /&(/%&/%%&¤%¤" 20)'
\r
177 +test_expect_equal $output '"max-length-test"'
\r
179 +test_begin_subtest "filename #9"
\r
180 +output=$(test_emacs '(notmuch-wash-subject-to-filename
\r
181 + "[a prefix] [is only separated] by [spaces], so \"by\" is not okay!")'
\r
183 +test_expect_equal $output '"by-spaces-so-by-is-not-okay"'
\r
185 +# test notmuch-wash-subject-to-patch-filename (subject)
\r
186 +test_begin_subtest "patch filename #1"
\r
187 +output=$(test_emacs '(notmuch-wash-subject-to-patch-filename
\r
188 + "[RFC][PATCH 099/100] rewrite notmuch")'
\r
190 +test_expect_equal "$output" '"0099-rewrite-notmuch.patch"'
\r
192 +test_begin_subtest "patch filename #2"
\r
193 +output=$(test_emacs '(notmuch-wash-subject-to-patch-filename
\r
194 + "[RFC PATCH v1] has no patch number, default to 1")'
\r
196 +test_expect_equal "$output" '"0001-has-no-patch-number-default-to-1.patch"'
\r
198 +test_begin_subtest "patch filename #3"
\r
199 +output=$(test_emacs '(notmuch-wash-subject-to-patch-filename
\r
200 + "[PATCH 4/5] the maximum length of a patch filename is 52 + patch sequence number + .patch extension")'
\r
202 +test_expect_equal "$output" '"0004-the-maximum-length-of-a-patch-filename-is-52-patch-s.patch"'
\r
204 +test_begin_subtest "patch filename #4"
\r
205 +output=$(test_emacs '(notmuch-wash-subject-to-patch-filename
\r
206 + "[PATCH 4/5] the maximum length of a patch filename is 52 + patchh ! sequence number + .patch extension, *before* trimming trailing - and .")'
\r
208 +test_expect_equal "$output" '"0004-the-maximum-length-of-a-patch-filename-is-52-patchh.patch"'
\r
211 diff --git a/test/notmuch-test b/test/notmuch-test
\r
212 index ded79e8..e40ef86 100755
\r
213 --- a/test/notmuch-test
\r
214 +++ b/test/notmuch-test
\r
215 @@ -42,6 +42,7 @@ TESTS="
\r
218 emacs-large-search-buffer
\r
219 + emacs-subject-to-filename
\r