1 Return-Path: <dme@dme.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 E4D2F431FD0
\r
6 for <notmuch@notmuchmail.org>; Thu, 25 Nov 2010 06:13:12 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_NONE=-0.0001] 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 w4nVARcWn5yB for <notmuch@notmuchmail.org>;
\r
16 Thu, 25 Nov 2010 06:13:12 -0800 (PST)
\r
17 Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com
\r
18 [74.125.82.45]) by olra.theworths.org (Postfix) with ESMTP id 1DD13431FB5 for
\r
19 <notmuch@notmuchmail.org>; Thu, 25 Nov 2010 06:13:11 -0800 (PST)
\r
20 Received: by wwi18 with SMTP id 18so937253wwi.2
\r
21 for <notmuch@notmuchmail.org>; Thu, 25 Nov 2010 06:13:09 -0800 (PST)
\r
22 Received: by 10.227.157.148 with SMTP id b20mr933637wbx.14.1290694389117;
\r
23 Thu, 25 Nov 2010 06:13:09 -0800 (PST)
\r
24 Received: from ut.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com
\r
26 by mx.google.com with ESMTPS id x65sm356739weq.1.2010.11.25.06.13.07
\r
27 (version=TLSv1/SSLv3 cipher=RC4-MD5);
\r
28 Thu, 25 Nov 2010 06:13:08 -0800 (PST)
\r
29 Received: by ut.hh.sledj.net (Postfix, from userid 1000)
\r
30 id D0886594058; Thu, 25 Nov 2010 14:09:07 +0000 (GMT)
\r
31 From: David Edmondson <dme@dme.org>
\r
32 To: notmuch@notmuchmail.org
\r
33 Subject: [PATCH] test: Add some more emacs tests.
\r
34 Date: Thu, 25 Nov 2010 14:09:06 +0000
\r
35 Message-Id: <1290694146-8990-1-git-send-email-dme@dme.org>
\r
36 X-Mailer: git-send-email 1.7.2.3
\r
37 In-Reply-To: <1290682750-30283-1-git-send-email-dme@dme.org>
\r
38 References: <1290682750-30283-1-git-send-email-dme@dme.org>
\r
39 X-BeenThere: notmuch@notmuchmail.org
\r
40 X-Mailman-Version: 2.1.13
\r
42 List-Id: "Use and development of the notmuch mail system."
\r
43 <notmuch.notmuchmail.org>
\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
47 List-Post: <mailto:notmuch@notmuchmail.org>
\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
51 X-List-Received-Date: Thu, 25 Nov 2010 14:13:13 -0000
\r
53 Simple version of the `notmuch-hello' test, some tests of the matrix
\r
54 reflection code and the 're:' stripping code.
\r
56 emacs/notmuch-test.el | 62 +++++++++++++++++++++++++++++++--
\r
57 test/emacs-ert | 3 ++
\r
58 test/emacs.expected-output/emacs-ert | 20 ++++++----
\r
59 3 files changed, 73 insertions(+), 12 deletions(-)
\r
61 diff --git a/emacs/notmuch-test.el b/emacs/notmuch-test.el
\r
62 index ac6e5a7..7d76537 100644
\r
63 --- a/emacs/notmuch-test.el
\r
64 +++ b/emacs/notmuch-test.el
\r
69 +(defun notmuch-test-file-as-string (filename)
\r
71 + (insert-file-contents filename)
\r
74 +;; This tends not to work well except in batch mode.
\r
75 +(defun notmuch-test-expected-result (name)
\r
76 + "Get the expected result of a test as a string."
\r
77 + (notmuch-test-file-as-string
\r
78 + (concat (getenv "EXPECTED") "/" name)))
\r
80 +(defun notmuch-test-buffer-result (fn)
\r
82 + (buffer-substring-no-properties (point-min) (point-max)))
\r
86 (require 'notmuch-maildir-fcc)
\r
88 (ert-deftest notmuch-fcc-trivial ()
\r
89 @@ -85,12 +102,49 @@
\r
93 -(defun notmuch-test ()
\r
94 - "Run the notmuch ERT tests."
\r
96 +(require 'notmuch-hello)
\r
98 +(ert-deftest notmuch-hello ()
\r
99 + "Check that `notmuch-hello' outputs correct data.
\r
101 +Presumes that the email corpus is already present."
\r
103 + (should (string= (notmuch-test-buffer-result 'notmuch-hello)
\r
104 + (notmuch-test-expected-result "notmuch-hello"))))
\r
106 +(ert-deftest notmuch-hello-reflect ()
\r
107 + (should (equal '(1 4 7 10 2 5 8 11 3 6 9 12)
\r
108 + (notmuch-hello-reflect '(1 2 3 4 5 6 7 8 9 10 11 12) 4)))
\r
110 + (should (equal '(1 4 7 10 2 5 8 nil 3 6 9 nil)
\r
111 + (notmuch-hello-reflect '(1 2 3 4 5 6 7 8 9 10) 4))))
\r
115 +(require 'notmuch-show)
\r
117 +(ert-deftest notmuch-show-strip-re ()
\r
118 + (mapc '(lambda (test)
\r
119 + (should (string= "fish"
\r
120 + (notmuch-show-strip-re test))))
\r
121 + '("fish" "re: fish" "Re: fish" "RE: fish"))
\r
124 + (mapc '(lambda (test)
\r
125 + (should (string= "some fish"
\r
126 + (notmuch-show-strip-re test))))
\r
127 + '("some fish" "re: some fish" "some re: fish"))
\r
129 + (mapc '(lambda (test)
\r
130 + (should-not (string= "some fish"
\r
131 + (notmuch-show-strip-re test))))
\r
132 + '(" some fish" "re: some fish " "somere: fish" "some fish re:")))
\r
136 (defun notmuch-test-batch ()
\r
137 "Run the notmuch ERT tests in batch mode."
\r
139 + ;; Avoid the 10 column default of `emacs --batch'.
\r
140 + (set-frame-width (window-frame (get-buffer-window)) 80)
\r
142 (ert-run-tests-batch-and-exit))
\r
143 diff --git a/test/emacs-ert b/test/emacs-ert
\r
144 index 4a45a66..60da9b6 100755
\r
145 --- a/test/emacs-ert
\r
146 +++ b/test/emacs-ert
\r
147 @@ -3,6 +3,9 @@ test_description="emacs interface (ert)"
\r
150 EXPECTED=../emacs.expected-output
\r
155 test_begin_subtest "Emacs tests using ert"
\r
157 diff --git a/test/emacs.expected-output/emacs-ert b/test/emacs.expected-output/emacs-ert
\r
158 index 50f592b..3cdf524 100644
\r
159 --- a/test/emacs.expected-output/emacs-ert
\r
160 +++ b/test/emacs.expected-output/emacs-ert
\r
162 -Running 6 tests (today)
\r
163 - passed 1/6 notmuch-fcc-multiple
\r
164 - passed 2/6 notmuch-fcc-none
\r
165 - passed 3/6 notmuch-fcc-oldstyle
\r
166 - passed 4/6 notmuch-fcc-regexp
\r
167 - passed 5/6 notmuch-fcc-simple
\r
168 - passed 6/6 notmuch-fcc-trivial
\r
169 +Source file `/one/home/dme/s/notmuch/emacs/notmuch-show.el' newer than byte-compiled file
\r
170 +Running 9 tests (today)
\r
171 + passed 1/9 notmuch-fcc-multiple
\r
172 + passed 2/9 notmuch-fcc-none
\r
173 + passed 3/9 notmuch-fcc-oldstyle
\r
174 + passed 4/9 notmuch-fcc-regexp
\r
175 + passed 5/9 notmuch-fcc-simple
\r
176 + passed 6/9 notmuch-fcc-trivial
\r
177 + passed 7/9 notmuch-hello
\r
178 + passed 8/9 notmuch-hello-reflect
\r
179 + passed 9/9 notmuch-show-strip-re
\r
181 -Ran 6 tests, 6 results as expected (today)
\r
182 +Ran 9 tests, 9 results as expected (today)
\r