]> git.notmuchmail.org Git - notmuch/commitdiff
test: add test for `notmuch-hello-refresh-hook'
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Wed, 21 Dec 2011 18:18:26 +0000 (22:18 +0400)
committerDavid Bremner <bremner@debian.org>
Thu, 22 Dec 2011 10:57:46 +0000 (06:57 -0400)
Test that `notmuch-hello-refresh-hook' is called once when
`notmuch-hello' is called and twice when calling
`notmuch-hello-update' after that.

The tests are very similar to tests for `notmuch-hello-mode-hook'.

test/emacs
test/test-lib.el

index dffad0fc171a2fc93d1b1ffc58abe403a1cfe768..ca8244531e3eb76780c97dcee8ba865c275829e3 100755 (executable)
@@ -495,4 +495,23 @@ counter=$(test_emacs \
 )
 test_expect_equal "$counter" 1
 
+test_begin_subtest "notmuch-hello-refresh hook is called"
+counter=$(test_emacs \
+    '(let ((notmuch-hello-refresh-hook-counter 0))
+       (kill-buffer "*notmuch-hello*")
+       (notmuch-hello)
+       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 ((notmuch-hello-refresh-hook-counter 0))
+       (kill-buffer "*notmuch-hello*")
+       (notmuch-hello)
+       (notmuch-hello-update)
+       notmuch-hello-refresh-hook-counter)'
+)
+test_expect_equal "$counter" 2
+
 test_done
index 83b8a651269e9c260e1f60a060007c53e77edc77..3b817c3730498cecefdb4e7508305b64724df224 100644 (file)
@@ -75,3 +75,4 @@ nothing."
   (add-hook hook (apply-partially 'hook-counter hook)))
 
 (add-hook-counter 'notmuch-hello-mode-hook)
+(add-hook-counter 'notmuch-hello-refresh-hook)