aboutsummaryrefslogtreecommitdiff
path: root/test/test-lib.el
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2021-08-30 12:49:06 -0700
committerDavid Bremner <david@tethera.net>2021-09-08 23:01:02 -0300
commitdc8262bd336f1c406e5705ec8cb5029f1bacd524 (patch)
tree257665514423e878c248b881fb600e3318e152ed /test/test-lib.el
parent17bfc25bb35dc8d1d6686298c6f842a3ce450940 (diff)
test/emacs: test for functions in notmuch-search-result-format.
Based on the commit message in id:20210221151902.2301690-3-dme@dme.org Add the function notmuch-test-result-flags to test-lib.el to avoid repeating it in 3 T*.sh files.
Diffstat (limited to 'test/test-lib.el')
-rw-r--r--test/test-lib.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/test-lib.el b/test/test-lib.el
index 32d53736..c840bc98 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -159,6 +159,21 @@ running, quit if it terminated."
(lambda (x) `(prog1 ,x (notmuch-post-command)))
body)))
+;; For testing functions in
+;; notmuch-{search,tree,unsorted}-result-format
+(defun notmuch-test-result-flags (format-string result)
+ (let ((tags-to-letters (quote (("attachment" . "&")
+ ("signed" . "=")
+ ("unread" . "u")
+ ("inbox" . "i"))))
+ (tags (plist-get result :tags)))
+ (format format-string
+ (mapconcat (lambda (t2l)
+ (if (member (car t2l) tags)
+ (cdr t2l)
+ " "))
+ tags-to-letters ""))))
+
;; For historical reasons, we hide deleted tags by default in the test
;; suite
(setq notmuch-tag-deleted-formats