]> git.notmuchmail.org Git - notmuch/commitdiff
test: Add tests for emacs notmuch-search and notmuch-show functions.
authorCarl Worth <cworth@cworth.org>
Fri, 22 Oct 2010 23:32:38 +0000 (16:32 -0700)
committerCarl Worth <cworth@cworth.org>
Fri, 22 Oct 2010 23:58:35 +0000 (16:58 -0700)
Moving the expected output into individual files (rather than inline)
to keep the test script much easier to read.

test/emacs
test/emacs.expected-output/notmuch-hello [new file with mode: 0644]
test/emacs.expected-output/notmuch-search-tag-inbox [new file with mode: 0644]
test/emacs.expected-output/notmuch-show-thread-9 [new file with mode: 0644]

index 635350cb620e9aa010430fdc79dc547781f08447..228ea565c4739bf554a5adc786f1d663c25a9757 100755 (executable)
@@ -2,24 +2,23 @@
 test_description="emacs interface"
 . test-lib.sh
 
 test_description="emacs interface"
 . test-lib.sh
 
+EXPECTED=../emacs.expected-output
+
 add_email_corpus
 
 add_email_corpus
 
-test_begin_subtest "Test emacs-hello interface"
+test_begin_subtest "Basic notmuch-hello view in emacs"
 output=$(test_emacs '(notmuch-hello) (message (buffer-string))' 2>&1)
 output=$(test_emacs '(notmuch-hello) (message (buffer-string))' 2>&1)
-test_expect_equal "$output" "   Welcome to notmuch. You have 50 messages.
-
-Saved searches: [edit]
-
-         50 inbox           50 unread    
-
-Search:                                                                     
-
-[Show all tags]
-
-        Type a search query and hit RET to view matching threads.
-               Edit saved searches with the \`edit' button.
-  Hit RET or click on a saved search or tag name to view matching threads.
-    \`=' refreshes this screen. \`s' jumps to the search box. \`q' to quit."
-
+expected=$(cat $EXPECTED/notmuch-hello)
+test_expect_equal "$output" "$expected"
+
+test_begin_subtest "Basic notmuch-search view in emacs"
+output=$(test_emacs '(notmuch-search "tag:inbox") (while (get-buffer-process (current-buffer)) (sleep-for 0.1)) (message (buffer-string))' 2>&1)
+expected=$(cat $EXPECTED/notmuch-search-tag-inbox)
+test_expect_equal "$output" "$expected"
+
+test_begin_subtest "Basic notmuch-show view in emacs"
+output=$(test_emacs '(notmuch-show "thread:0000000000000009") (message (buffer-string))' 2>&1)
+expected=$(cat $EXPECTED/notmuch-show-thread-9)
+test_expect_equal "$output" "$expected"
 
 test_done
 
 test_done
diff --git a/test/emacs.expected-output/notmuch-hello b/test/emacs.expected-output/notmuch-hello
new file mode 100644 (file)
index 0000000..64b7e42
--- /dev/null
@@ -0,0 +1,14 @@
+   Welcome to notmuch. You have 50 messages.
+
+Saved searches: [edit]
+
+         50 inbox           50 unread    
+
+Search:                                                                     
+
+[Show all tags]
+
+        Type a search query and hit RET to view matching threads.
+               Edit saved searches with the `edit' button.
+  Hit RET or click on a saved search or tag name to view matching threads.
+    `=' refreshes this screen. `s' jumps to the search box. `q' to quit.
diff --git a/test/emacs.expected-output/notmuch-search-tag-inbox b/test/emacs.expected-output/notmuch-search-tag-inbox
new file mode 100644 (file)
index 0000000..8804fa3
--- /dev/null
@@ -0,0 +1,23 @@
+  2009-11-18 [1/1]   Chris Wilson         [notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (inbox unread)
+  2009-11-18 [2/2]   Carl Worth, Alex Botero-Lowry [notmuch] [PATCH] Error out if no query is supplied to search instead of going into an infinite loop (inbox unread)
+  2009-11-18 [2/2]   Carl Worth, Ingmar Vanhassel [notmuch] [PATCH] Typsos (inbox unread)
+  2009-11-18 [3/3]   Carl Worth, Keith Packard, Adrian Perez de Castro [notmuch] Introducing myself (inbox unread)
+  2009-11-18 [3/3]   Carl Worth, Keith Packard, Israel Herraiz [notmuch] New to the list (inbox unread)
+  2009-11-18 [3/3]   Carl Worth, Jan Janak [notmuch] What a great idea! (inbox unread)
+  2009-11-18 [2/2]   Carl Worth, Jan Janak [notmuch] [PATCH] Older versions of install do not support -C. (inbox unread)
+  2009-11-18 [3/3]   Carl Worth, Keith Packard, Aron Griffis [notmuch] archive (inbox unread)
+  2009-11-18 [2/2]   Carl Worth, Keith Packard [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox unread)
+  2009-11-18 [7/7]   Carl Worth, Lars Kellogg-Stedman, Keith Packard, Mikhail Gusarov [notmuch] Working with Maildir storage? (inbox unread)
+  2009-11-18 [5/5]   Carl Worth, Keith Packard, Mikhail Gusarov [notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox unread)
+  2009-11-18 [2/2]   Alexander Botero-Lowry, Keith Packard [notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox unread)
+  2009-11-18 [1/1]   Alexander Botero-Lowry [notmuch] request for pull (inbox unread)
+  2009-11-18 [4/4]   Alexander Botero-Lowry, Jjgod Jiang [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)
+  2009-11-18 [1/1]   Rolland Santimano    [notmuch] Link to mailing list archives ? (inbox unread)
+  2009-11-18 [1/1]   Jan Janak            [notmuch] [PATCH] notmuch new: Support for conversion of spool subdirectories into tags (inbox unread)
+  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH] count_files: sort directory in inode order before statting (inbox unread)
+  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH 2/2] Read mail directory in inode number order (inbox unread)
+  2009-11-18 [1/1]   Stewart Smith        [notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++ libs. (inbox unread)
+  2009-11-18 [2/2]   Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to stderr? (inbox unread)
+  2009-11-17 [1/1]   Mikhail Gusarov      [notmuch] [PATCH] Handle rename of message file (inbox unread)
+  2009-11-17 [2/2]   Carl Worth, Alex Botero-Lowry [notmuch] preliminary FreeBSD support (inbox unread)
+End of search results.
diff --git a/test/emacs.expected-output/notmuch-show-thread-9 b/test/emacs.expected-output/notmuch-show-thread-9
new file mode 100644 (file)
index 0000000..8f18afd
--- /dev/null
@@ -0,0 +1,204 @@
+"Lars Kellogg-Stedman" <lars@seas.harvard.edu> (2009-11-17) (inbox)
+Subject: [notmuch] Working with Maildir storage?
+To: notmuch@notmuchmail.org
+Date: Tue, 17 Nov 2009 14:00:54 -0500
+
+I saw the LWN article and decided to take a look at notmuch.  I'm
+currently using mutt and mairix to index and read a collection of
+Maildir mail folders (around 40,000 messages total).
+
+notmuch indexed the messages without complaint, but my attempt at
+searching bombed out. Running, for example:
+
+  notmuch search storage
+
+Resulted in 4604 lines of errors along the lines of:
+
+  Error opening
+  /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
+  Too many open files
+
+I'm curious if this is expected behavior (i.e., notmuch does not work
+with Maildir) or if something else is going on.
+
+Cheers,
+
+[ 12-line signature. Click/Enter to toggle visibility. ]
+-- 
+Lars Kellogg-Stedman <lars at seas.harvard.edu>
+Senior Technologist, Computing and Information Technology
+Harvard University School of Engineering and Applied Sciences
+
+-------------- next part --------------
+A non-text attachment was scrubbed...
+Name: not available
+Type: application/pgp-signature
+Size: 489 bytes
+Desc: not available
+URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091117/0bc8f9bd/attachment.pgp>
+
+ "Mikhail Gusarov" <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
+ Subject: [notmuch] Working with Maildir storage?
+ To: notmuch@notmuchmail.org
+ Date: Wed, 18 Nov 2009 01:02:38 +0600
+
+
+ Twas brillig at 14:00:54 17.11.2009 UTC-05 when lars at seas.harvard.edu did gyre and gimble:
+
+  LK> Resulted in 4604 lines of errors along the lines of:
+
+  LK>   Error opening
+  LK>   /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
+  LK>   Too many open files
+
+ See the patch just posted here.
+
+ [ 9-line signature. Click/Enter to toggle visibility. ]
+ -- 
+ http://fossarchy.blogspot.com/
+ -------------- next part --------------
+ A non-text attachment was scrubbed...
+ Name: not available
+ Type: application/pgp-signature
+ Size: 834 bytes
+ Desc: not available
+ URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091118/60743c36/attachment.pgp>
+
+  "Lars Kellogg-Stedman" <lars@seas.harvard.edu> (2009-11-17) (inbox unread)
+  Subject: [notmuch] Working with Maildir storage?
+  To: notmuch@notmuchmail.org
+  Date: Tue, 17 Nov 2009 15:33:01 -0500
+
+  > See the patch just posted here.
+
+  Is the list archived anywhere?  The obvious archives
+  (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
+  think I subscribed too late to get the patch (I only just saw the
+  discussion about it).
+
+  It doesn't look like the patch is in git yet.
+
+  -- Lars
+
+  [ 12-line signature. Click/Enter to toggle visibility. ]
+  -- 
+  Lars Kellogg-Stedman <lars at seas.harvard.edu>
+  Senior Technologist, Computing and Information Technology
+  Harvard University School of Engineering and Applied Sciences
+
+  -------------- next part --------------
+  A non-text attachment was scrubbed...
+  Name: not available
+  Type: application/pgp-signature
+  Size: 489 bytes
+  Desc: not available
+  URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091117/5bed6654/attachment.pgp>
+
+   "Mikhail Gusarov" <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
+   Subject: [notmuch] Working with Maildir storage?
+   To: notmuch@notmuchmail.org
+   Date: Wed, 18 Nov 2009 02:50:48 +0600
+
+
+   Twas brillig at 15:33:01 17.11.2009 UTC-05 when lars at seas.harvard.edu did gyre and gimble:
+
+    LK> Is the list archived anywhere?  The obvious archives
+    LK> (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
+    LK> think I subscribed too late to get the patch (I only just saw the
+    LK> discussion about it).
+
+    LK> It doesn't look like the patch is in git yet.
+
+   Just has been pushed
+
+   [ 9-line signature. Click/Enter to toggle visibility. ]
+   -- 
+   http://fossarchy.blogspot.com/
+   -------------- next part --------------
+   A non-text attachment was scrubbed...
+   Name: not available
+   Type: application/pgp-signature
+   Size: 834 bytes
+   Desc: not available
+   URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091118/0e33d964/attachment.pgp>
+
+   "Keith Packard" <keithp@keithp.com> (2009-11-17) (inbox unread)
+   Subject: [notmuch] Working with Maildir storage?
+   To: notmuch@notmuchmail.org
+   Date: Tue, 17 Nov 2009 13:24:13 -0800
+
+   On Tue, 17 Nov 2009 15:33:01 -0500, Lars Kellogg-Stedman <lars at seas.harvard.edu> wrote:
+   > > See the patch just posted here.
+
+   I've also pushed a slightly more complicated (and complete) fix to my
+   private notmuch repository
+
+   git://keithp.com/git/notmuch
+
+   > Is the list archived anywhere?
+
+   Oops. Looks like Carl's mail server is broken. He's traveling to
+   Barcelona today and so it won't get fixed for a while.
+
+   Thanks to everyone for trying out notmuch!
+
+   -keith
+
+    "Lars Kellogg-Stedman" <lars@seas.harvard.edu> (2009-11-18) (inbox unread)
+    Subject: [notmuch] Working with Maildir storage?
+    To: notmuch@notmuchmail.org
+    Date: Tue, 17 Nov 2009 19:50:40 -0500
+
+    > I've also pushed a slightly more complicated (and complete) fix to my
+    > private notmuch repository
+
+    The version of lib/messages.cc in your repo doesn't build because it's
+    missing "#include <stdint.h>" (for the uint32_t on line 466).
+
+    [ 12-line signature. Click/Enter to toggle visibility. ]
+    -- 
+    Lars Kellogg-Stedman <lars at seas.harvard.edu>
+    Senior Technologist, Computing and Information Technology
+    Harvard University School of Engineering and Applied Sciences
+
+    -------------- next part --------------
+    A non-text attachment was scrubbed...
+    Name: not available
+    Type: application/pgp-signature
+    Size: 489 bytes
+    Desc: not available
+    URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091117/b069f470/attachment.pgp>
+
+ "Carl Worth" <cworth@cworth.org> (2009-11-18) (inbox unread)
+ Subject: [notmuch] Working with Maildir storage?
+ To: notmuch@notmuchmail.org
+ Date: Wed, 18 Nov 2009 02:08:10 -0800
+
+ On Tue, 17 Nov 2009 14:00:54 -0500, Lars Kellogg-Stedman <lars at seas.harvard.edu> wrote:
+ > I saw the LWN article and decided to take a look at notmuch.  I'm
+ > currently using mutt and mairix to index and read a collection of
+ > Maildir mail folders (around 40,000 messages total).
+
+ Welcome, Lars!
+
+ I hadn't even seen that Keith's blog post had been picked up by lwn.net.
+ That's very interesting. So, thanks for coming and trying out notmuch.
+
+ >   Error opening
+ >   /home/lars/Mail/read-messages.2008/cur/1246413773.24928_27334.hostname,U=3026:2,S:
+ >   Too many open files
+
+ Sadly, the lwn article coincided with me having just introduced this
+ bug, and then getting on a Trans-Atlantic flight. So I fixed the bug
+ fairly quickly, but there was quite a bit of latency before I could push
+ the fix out. It should be fixed now.
+
+ > I'm curious if this is expected behavior (i.e., notmuch does not work
+ > with Maildir) or if something else is going on.
+
+ Notmuch works just fine with maildir---it's one of the things that it
+ likes the best.
+
+ Happy hacking,
+
+ -Carl