emacs: Tests for user-defined sections
authorDaniel Schoepe <daniel.schoepe@googlemail.com>
Fri, 17 Feb 2012 14:48:08 +0000 (18:48 +0400)
committerDavid Bremner <bremner@debian.org>
Thu, 1 Mar 2012 12:16:55 +0000 (08:16 -0400)
A new file was added for notmuch-hello tests.

test/emacs-hello [new file with mode: 0755]
test/emacs.expected-output/notmuch-hello
test/emacs.expected-output/notmuch-hello-new-section [new file with mode: 0644]
test/emacs.expected-output/notmuch-hello-no-saved-searches
test/emacs.expected-output/notmuch-hello-section-counts [new file with mode: 0644]
test/emacs.expected-output/notmuch-hello-section-hidden-tag [new file with mode: 0644]
test/emacs.expected-output/notmuch-hello-section-with-empty [new file with mode: 0644]
test/emacs.expected-output/notmuch-hello-with-empty
test/notmuch-test

diff --git a/test/emacs-hello b/test/emacs-hello
new file mode 100755 (executable)
index 0000000..b235e3a
--- /dev/null
@@ -0,0 +1,47 @@
+#!/usr/bin/env bash
+
+test_description="Testing emacs notmuch-hello view"
+. test-lib.sh
+
+EXPECTED=$TEST_DIRECTORY/emacs.expected-output
+
+add_email_corpus
+
+test_begin_subtest "User-defined section with inbox tag"
+test_emacs "(let ((notmuch-hello-sections
+                   (list (lambda () (notmuch-hello-insert-searches
+                                     \"Test\" '((\"inbox\" . \"tag:inbox\")))))))
+           (notmuch-hello)
+           (test-output))"
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-new-section
+
+test_begin_subtest "User-defined section with empty, hidden entry"
+test_emacs "(let ((notmuch-hello-sections
+                   (list (lambda () (notmuch-hello-insert-searches
+                                     \"Test-with-empty\"
+                                     '((\"inbox\" . \"tag:inbox\")
+                                       (\"doesnotexist\" . \"tag:doesnotexist\"))
+                                     :hide-empty-searches t)))))
+             (notmuch-hello)
+             (test-output))"
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-section-with-empty
+
+test_begin_subtest "User-defined section, unread tag filtered out"
+test_emacs "(let ((notmuch-hello-sections
+                   (list (lambda () (notmuch-hello-insert-tags-section
+                                     \"Test-with-filtered\"
+                                     :hide-tags '(\"unread\"))))))
+             (notmuch-hello)
+             (test-output))"
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-section-hidden-tag
+
+test_begin_subtest "User-defined section, different query for counts"
+test_emacs "(let ((notmuch-hello-sections
+                   (list (lambda () (notmuch-hello-insert-tags-section
+                                     \"Test-with-counts\"
+                                     :filter-count \"tag:signed\")))))
+             (notmuch-hello)
+             (test-output))"
+test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-section-counts
+
+test_done
index 3e59595f91416e03093466c09e184f29c01ca9c3..147079064ec94e20ffd43e4bd18c7c6283594bae 100644 (file)
@@ -6,9 +6,10 @@ Saved searches: [edit]
 
 Search:                                                                     .
 
-[Show all tags]
+All tags: [show]
 
         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.
       `=' to refresh this screen. `s' to search messages. `q' to quit.
+                           Customize this page.
diff --git a/test/emacs.expected-output/notmuch-hello-new-section b/test/emacs.expected-output/notmuch-hello-new-section
new file mode 100644 (file)
index 0000000..c64d712
--- /dev/null
@@ -0,0 +1,4 @@
+Test: [hide]
+
+         52 inbox  
+
index ef0e5d050511b9e28024008fb56a63200b6f1f78..05475b15abee9c81a4fc30907438c83c7fd73e23 100644 (file)
@@ -2,9 +2,10 @@
 
 Search:                                                                     .
 
-[Show all tags]
+All tags: [show]
 
         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.
       `=' to refresh this screen. `s' to search messages. `q' to quit.
+                           Customize this page.
diff --git a/test/emacs.expected-output/notmuch-hello-section-counts b/test/emacs.expected-output/notmuch-hello-section-counts
new file mode 100644 (file)
index 0000000..9d79659
--- /dev/null
@@ -0,0 +1,5 @@
+Test-with-counts: [hide]
+
+          2 attachment             7 signed          
+          7 inbox                  7 unread          
+
diff --git a/test/emacs.expected-output/notmuch-hello-section-hidden-tag b/test/emacs.expected-output/notmuch-hello-section-hidden-tag
new file mode 100644 (file)
index 0000000..3688e7c
--- /dev/null
@@ -0,0 +1,4 @@
+Test-with-filtered: [hide]
+
+          4 attachment            52 inbox                  7 signed 
+
diff --git a/test/emacs.expected-output/notmuch-hello-section-with-empty b/test/emacs.expected-output/notmuch-hello-section-with-empty
new file mode 100644 (file)
index 0000000..8209fed
--- /dev/null
@@ -0,0 +1,4 @@
+Test-with-empty: [hide]
+
+         52 inbox  
+
index 71edba73ba8672839efe181b9b0aac1ea05fee67..5e5322210dbdfb96db71adedd84a6d8100a0a80f 100644 (file)
@@ -6,9 +6,10 @@ Saved searches: [edit]
 
 Search:                                                                     .
 
-[Show all tags]
+All tags: [show]
 
         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.
       `=' to refresh this screen. `s' to search messages. `q' to quit.
+                           Customize this page.
index e14d34e424705851951aad5c4c650ab555ace7fc..f03b594d0b753a3518520cc84163cdeb71b2f5ca 100755 (executable)
@@ -54,6 +54,7 @@ TESTS="
   argument-parsing
   emacs-test-functions
   emacs-address-cleaning
+  emacs-hello
   emacs-show
 "
 TESTS=${NOTMUCH_TESTS:=$TESTS}