[PATCH] test: stashing in notmuch-{show,search}

Pieter Praet pieter at praet.org
Thu Jun 30 01:23:23 PDT 2011


Should provide full test coverage of the stashing feature.

Signed-off-by: Pieter Praet <pieter at praet.org>
---
 test/emacs                                |   41 +++++++++++++++++++++++++++++
 test/emacs.expected-output/emacs-stashing |    9 ++++++
 2 files changed, 50 insertions(+), 0 deletions(-)
 create mode 100644 test/emacs.expected-output/emacs-stashing

diff --git a/test/emacs b/test/emacs
index 53f455a..46076c6 100755
--- a/test/emacs
+++ b/test/emacs
@@ -347,4 +347,45 @@ test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae at mail.
 	    (test-visible-output)'
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-hidden-messages
 
+test_begin_subtest "Stashing in notmuch-show"
+add_message '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' \
+    '[from]="Some One <someone at somewhere.org>"' \
+    '[to]="Some One Else <notsomeone at somewhere.org>"' \
+    '[cc]="Notmuch <notmuch at notmuchmail.org>"' \
+    '[subject]="Stash my stashables"' \
+    '[id]="bought"' \
+    '[body]="Unable to stash body. Where did you get it in the first place?!?"'
+notmuch tag +stashtest id:${gen_msg_id}
+test_emacs '(notmuch-show "id:\"bought\"")
+        (notmuch-show-stash-date)
+        (notmuch-show-stash-from)
+        (notmuch-show-stash-to)
+        (notmuch-show-stash-cc)
+        (notmuch-show-stash-subject)
+        (notmuch-show-stash-message-id)
+        (notmuch-show-stash-message-id-stripped)
+        (notmuch-show-stash-tags)
+        (notmuch-show-stash-filename)
+        (switch-to-buffer
+          (generate-new-buffer "*test-stashing*"))
+        (dotimes (i 9)
+          (yank)
+          (insert "\n")
+          (rotate-yank-pointer 1))
+        (reverse-region (point-min) (point-max))
+	    (test-output)'
+sed -i -e 's/^.*tmp.emacs\/mail.*$/FILENAME/' OUTPUT
+test_expect_equal_file OUTPUT $EXPECTED/emacs-stashing
+
+test_begin_subtest "Stashing in notmuch-search"
+test_emacs '(notmuch-search "id:\"bought\"")
+        (notmuch-test-wait)
+        (notmuch-search-stash-thread-id)
+        (switch-to-buffer
+          (generate-new-buffer "*test-stashing*"))
+        (yank)
+	    (test-output)'
+sed -i -e 's/^thread:.*$/thread:XXX/' OUTPUT
+test_expect_equal $(cat OUTPUT) "thread:XXX"
+
 test_done
diff --git a/test/emacs.expected-output/emacs-stashing b/test/emacs.expected-output/emacs-stashing
new file mode 100644
index 0000000..4923594
--- /dev/null
+++ b/test/emacs.expected-output/emacs-stashing
@@ -0,0 +1,9 @@
+Sat, 01 Jan 2000 12:00:00 -0000
+Some One <someone at somewhere.org>
+Some One Else <notsomeone at somewhere.org>
+Notmuch <notmuch at notmuchmail.org>
+Stash my stashables
+id:"bought"
+bought
+inbox,stashtest
+FILENAME
-- 
1.7.4.1



More information about the notmuch mailing list