Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 9d / a5c83cbca9d6324f241aa2b03daa3b89f9b926
1 Return-Path: <bremner@tesseract.cs.unb.ca>\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 50786431FD0\r
6         for <notmuch@notmuchmail.org>; Sat, 14 Dec 2013 17:16:41 -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\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 h8-zTsqkiWK5 for <notmuch@notmuchmail.org>;\r
16         Sat, 14 Dec 2013 17:16:35 -0800 (PST)\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
18         (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id BED8D431FD5\r
21         for <notmuch@notmuchmail.org>; Sat, 14 Dec 2013 17:16:25 -0800 (PST)\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
23         (envelope-from <bremner@tesseract.cs.unb.ca>)\r
24         id 1Vs0Jj-0000Si-8t; Sat, 14 Dec 2013 21:16:23 -0400\r
25 Received: (nullmailer pid 13656 invoked by uid 1000); Sun, 15 Dec 2013\r
26         01:16:11 -0000\r
27 From: David Bremner <david@tethera.net>\r
28 To: notmuch@notmuchmail.org\r
29 Subject: [PATCH 1/2] test: add emacs_fcc_message that does not use smtp-dummy\r
30 Date: Sun, 15 Dec 2013 09:15:57 +0800\r
31 Message-Id: <1387070158-30547-2-git-send-email-david@tethera.net>\r
32 X-Mailer: git-send-email 1.8.4.3\r
33 In-Reply-To: <1387070158-30547-1-git-send-email-david@tethera.net>\r
34 References: <1387070158-30547-1-git-send-email-david@tethera.net>\r
35 X-BeenThere: notmuch@notmuchmail.org\r
36 X-Mailman-Version: 2.1.13\r
37 Precedence: list\r
38 List-Id: "Use and development of the notmuch mail system."\r
39         <notmuch.notmuchmail.org>\r
40 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
41         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
42 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
43 List-Post: <mailto:notmuch@notmuchmail.org>\r
44 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
45 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
47 X-List-Received-Date: Sun, 15 Dec 2013 01:16:41 -0000\r
48 \r
49 Most of the tests previously using emacs_deliver_message do not use\r
50 the actual transmitted message, so we replace it with a simpler (and\r
51 presumably more reliable function) that only saves (and indexes) an\r
52 fcc copy of the message.\r
53 ---\r
54  test/crypto      | 10 +++-------\r
55  test/emacs       |  4 ++--\r
56  test/json        |  2 +-\r
57  test/sexp        |  2 +-\r
58  test/test-lib.sh | 29 +++++++++++++++++++++++++++++\r
59  5 files changed, 36 insertions(+), 11 deletions(-)\r
60 \r
61 diff --git a/test/crypto b/test/crypto\r
62 index 9e5ff4f..477b397 100755\r
63 --- a/test/crypto\r
64 +++ b/test/crypto\r
65 @@ -28,12 +28,8 @@ add_gnupg_home\r
66  # get key fingerprint\r
67  FINGERPRINT=$(gpg --no-tty --list-secret-keys --with-colons --fingerprint | grep '^fpr:' | cut -d: -f10)\r
68  \r
69 -# for some reason this is needed for emacs_deliver_message to work,\r
70 -# although I can't figure out why\r
71 -add_email_corpus\r
72 -\r
73  test_expect_success 'emacs delivery of signed message' \\r
74 -'emacs_deliver_message \\r
75 +'emacs_fcc_message \\r
76      "test signed message 001" \\r
77      "This is a test signed message." \\r
78      "(mml-secure-message-sign)"'\r
79 @@ -143,7 +139,7 @@ cat <<EOF >TESTATTACHMENT\r
80  This is a test file.\r
81  EOF\r
82  test_expect_success 'emacs delivery of encrypted message with attachment' \\r
83 -'emacs_deliver_message \\r
84 +'emacs_fcc_message \\r
85      "test encrypted message 001" \\r
86      "This is a test encrypted message.\n" \\r
87      "(mml-attach-file \"TESTATTACHMENT\") (mml-secure-message-encrypt)"'\r
88 @@ -270,7 +266,7 @@ test_expect_equal_json \\r
89  mv "${GNUPGHOME}"{.bak,}\r
90  \r
91  test_expect_success 'emacs delivery of encrypted + signed message' \\r
92 -'emacs_deliver_message \\r
93 +'emacs_fcc_message \\r
94      "test encrypted message 002" \\r
95      "This is another test encrypted message.\n" \\r
96      "(mml-secure-message-sign-encrypt)"'\r
97 diff --git a/test/emacs b/test/emacs\r
98 index 1b1ebe3..863219d 100755\r
99 --- a/test/emacs\r
100 +++ b/test/emacs\r
101 @@ -771,7 +771,7 @@ test_expect_equal_file OUTPUT EXPECTED\r
102  \r
103  test_begin_subtest "Do not call notmuch for non-inlinable application/mpeg parts"\r
104  id='message-with-application/mpeg-attachment@notmuchmail.org'\r
105 -emacs_deliver_message \\r
106 +emacs_fcc_message \\r
107      'Message with application/mpeg attachment' \\r
108      '' \\r
109      "(message-goto-eoh)\r
110 @@ -786,7 +786,7 @@ test_expect_equal $(notmuch_counter_value) 1\r
111  \r
112  test_begin_subtest "Do not call notmuch for non-inlinable audio/mpeg parts"\r
113  id='message-with-audio/mpeg-attachment@notmuchmail.org'\r
114 -emacs_deliver_message \\r
115 +emacs_fcc_message \\r
116      'Message with audio/mpeg attachment' \\r
117      '' \\r
118      "(message-goto-eoh)\r
119 diff --git a/test/json b/test/json\r
120 index e07a290..c1cf649 100755\r
121 --- a/test/json\r
122 +++ b/test/json\r
123 @@ -38,7 +38,7 @@ test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true\r
124  test_begin_subtest "Show message: json, inline attachment filename"\r
125  subject='json-show-inline-attachment-filename'\r
126  id="json-show-inline-attachment-filename@notmuchmail.org"\r
127 -emacs_deliver_message \\r
128 +emacs_fcc_message \\r
129      "$subject" \\r
130      'This is a test message with inline attachment with a filename' \\r
131      "(mml-attach-file \"$TEST_DIRECTORY/README\" nil nil \"inline\")\r
132 diff --git a/test/sexp b/test/sexp\r
133 index be815e1..667e319 100755\r
134 --- a/test/sexp\r
135 +++ b/test/sexp\r
136 @@ -29,7 +29,7 @@ test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :f\r
137  test_begin_subtest "Show message: sexp, inline attachment filename"\r
138  subject='sexp-show-inline-attachment-filename'\r
139  id="sexp-show-inline-attachment-filename@notmuchmail.org"\r
140 -emacs_deliver_message \\r
141 +emacs_fcc_message \\r
142      "$subject" \\r
143      'This is a test message with inline attachment with a filename' \\r
144      "(mml-attach-file \"$TEST_DIRECTORY/README\" nil nil \"inline\")\r
145 diff --git a/test/test-lib.sh b/test/test-lib.sh\r
146 index 53cb947..66c0720 100644\r
147 --- a/test/test-lib.sh\r
148 +++ b/test/test-lib.sh\r
149 @@ -470,6 +470,35 @@ emacs_deliver_message ()\r
150      notmuch new >/dev/null\r
151  }\r
152  \r
153 +# Pretend to deliver a message with emacs. Really save it to a file\r
154 +# and add it to the database\r
155 +#\r
156 +# Uses emacs to generate and deliver a message to the mail store.\r
157 +# Accepts arbitrary extra emacs/elisp functions to modify the message\r
158 +# before sending, which is useful to doing things like attaching files\r
159 +# to the message and encrypting/signing.\r
160 +emacs_fcc_message ()\r
161 +{\r
162 +    local subject="$1"\r
163 +    local body="$2"\r
164 +    shift 2\r
165 +    # before we can send a message, we have to prepare the FCC maildir\r
166 +    mkdir -p "$MAIL_DIR"/sent/{cur,new,tmp}\r
167 +\r
168 +    test_emacs \\r
169 +       "(let ((message-send-mail-function (lambda () t)))\r
170 +          (notmuch-mua-mail)\r
171 +          (message-goto-to)\r
172 +          (insert \"test_suite@notmuchmail.org\nDate: 01 Jan 2000 12:00:00 -0000\")\r
173 +          (message-goto-subject)\r
174 +          (insert \"${subject}\")\r
175 +          (message-goto-body)\r
176 +          (insert \"${body}\")\r
177 +          $@\r
178 +          (message-send-and-exit))" || return 1\r
179 +    notmuch new >/dev/null\r
180 +}\r
181 +\r
182  # Generate a corpus of email and add it to the database.\r
183  #\r
184  # This corpus is fixed, (it happens to be 50 messages from early in\r
185 -- \r
186 1.8.4.3\r
187 \r