[PATCH] test: add tests for `notmuch-hello-refresh-hook'

Thomas Jost schnouki at schnouki.net
Wed Dec 21 05:13:09 PST 2011


Test that it's called once when `notmuch-hello' is called, and twice when
calling `notmuch-hello-update' after that.
---
Here it is. No broken subtest first since the first patch was already pushed
though.

Regards,
Thomas

 test/emacs |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/test/emacs b/test/emacs
index dffad0f..94b9171 100755
--- a/test/emacs
+++ b/test/emacs
@@ -495,4 +495,27 @@ counter=$(test_emacs \
 )
 test_expect_equal "$counter" 1
 
+test_begin_subtest "notmuch-hello-refresh-hook is called"
+counter=$(test_emacs \
+    "(let ((refresh-hook-counter 0)
+           (notmuch-hello-refresh-hook nil))
+       (kill-buffer \"*notmuch-hello*\")
+       (add-hook 'notmuch-hello-refresh-hook (lambda () (incf refresh-hook-counter)))
+       (notmuch-hello)
+       refresh-hook-counter)"
+)
+test_expect_equal "$counter" 1
+
+test_begin_subtest "notmuch-hello-refresh-hook is called on updates"
+counter=$(test_emacs \
+    "(let ((refresh-hook-counter 0)
+           (notmuch-hello-refresh-hook nil))
+       (kill-buffer \"*notmuch-hello*\")
+       (add-hook 'notmuch-hello-refresh-hook (lambda () (incf refresh-hook-counter)))
+       (notmuch-hello)
+       (notmuch-hello-update)
+       refresh-hook-counter)"
+)
+test_expect_equal "$counter" 2
+
 test_done
-- 
1.7.8



More information about the notmuch mailing list