[PATCH v10 2/2] emacs: Tests for user-defined sections

2012-02-17 Thread Dmitry Kurochkin
From: Daniel Schoepe 

A new file was added for notmuch-hello tests.
---
 test/emacs-hello   |   47 
 test/emacs.expected-output/notmuch-hello   |3 +-
 .../notmuch-hello-new-section  |4 ++
 .../notmuch-hello-no-saved-searches|3 +-
 .../notmuch-hello-section-counts   |5 ++
 .../notmuch-hello-section-hidden-tag   |4 ++
 .../notmuch-hello-section-with-empty   |4 ++
 .../emacs.expected-output/notmuch-hello-with-empty |3 +-
 test/notmuch-test  |1 +
 9 files changed, 71 insertions(+), 3 deletions(-)
 create mode 100755 test/emacs-hello
 create mode 100644 test/emacs.expected-output/notmuch-hello-new-section
 create mode 100644 test/emacs.expected-output/notmuch-hello-section-counts
 create mode 100644 test/emacs.expected-output/notmuch-hello-section-hidden-tag
 create mode 100644 test/emacs.expected-output/notmuch-hello-section-with-empty

diff --git a/test/emacs-hello b/test/emacs-hello
new file mode 100755
index 000..b235e3a
--- /dev/null
+++ b/test/emacs-hello
@@ -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
diff --git a/test/emacs.expected-output/notmuch-hello 
b/test/emacs.expected-output/notmuch-hello
index 3e59595..1470790 100644
--- a/test/emacs.expected-output/notmuch-hello
+++ b/test/emacs.expected-output/notmuch-hello
@@ -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
index 000..c64d712
--- /dev/null
+++ b/test/emacs.expected-output/notmuch-hello-new-section
@@ -0,0 +1,4 @@
+Test: [hide]
+
+ 52 inbox  
+
diff --git a/test/emacs.expected-output/notmuch-hello-no-saved-searches 
b/test/emacs.expected-output/notmuch-hello-no-saved-searches
index ef0e5d0..05475b1 100644
--- a/test/emacs.expected-output/notmuch-hello-no-saved-searches
+++ b/test/emacs.expected-output/notmuch-hello-no-saved-searches
@@ -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.
+   

[PATCH v10 2/2] emacs: Tests for user-defined sections

2012-02-17 Thread Dmitry Kurochkin
From: Daniel Schoepe daniel.scho...@googlemail.com

A new file was added for notmuch-hello tests.
---
 test/emacs-hello   |   47 
 test/emacs.expected-output/notmuch-hello   |3 +-
 .../notmuch-hello-new-section  |4 ++
 .../notmuch-hello-no-saved-searches|3 +-
 .../notmuch-hello-section-counts   |5 ++
 .../notmuch-hello-section-hidden-tag   |4 ++
 .../notmuch-hello-section-with-empty   |4 ++
 .../emacs.expected-output/notmuch-hello-with-empty |3 +-
 test/notmuch-test  |1 +
 9 files changed, 71 insertions(+), 3 deletions(-)
 create mode 100755 test/emacs-hello
 create mode 100644 test/emacs.expected-output/notmuch-hello-new-section
 create mode 100644 test/emacs.expected-output/notmuch-hello-section-counts
 create mode 100644 test/emacs.expected-output/notmuch-hello-section-hidden-tag
 create mode 100644 test/emacs.expected-output/notmuch-hello-section-with-empty

diff --git a/test/emacs-hello b/test/emacs-hello
new file mode 100755
index 000..b235e3a
--- /dev/null
+++ b/test/emacs-hello
@@ -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
diff --git a/test/emacs.expected-output/notmuch-hello 
b/test/emacs.expected-output/notmuch-hello
index 3e59595..1470790 100644
--- a/test/emacs.expected-output/notmuch-hello
+++ b/test/emacs.expected-output/notmuch-hello
@@ -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
index 000..c64d712
--- /dev/null
+++ b/test/emacs.expected-output/notmuch-hello-new-section
@@ -0,0 +1,4 @@
+Test: [hide]
+
+ 52 inbox  
+
diff --git a/test/emacs.expected-output/notmuch-hello-no-saved-searches 
b/test/emacs.expected-output/notmuch-hello-no-saved-searches
index ef0e5d0..05475b1 100644
--- a/test/emacs.expected-output/notmuch-hello-no-saved-searches
+++ b/test/emacs.expected-output/notmuch-hello-no-saved-searches
@@ -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