]> git.notmuchmail.org Git - notmuch/blobdiff - test/test-lib.el
test/emacs: test for functions in notmuch-search-result-format.
[notmuch] / test / test-lib.el
index 32d53736482493f3cf336c187b0990cd97d57223..c840bc98b0597e781a08dcfa45fe0f428385cdba 100644 (file)
@@ -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