3 test_description="emacs notmuch-hello view"
4 . $(dirname "$0")/test-lib.sh || exit 1
5 . $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
7 EXPECTED=$NOTMUCH_SRCDIR/test/emacs.expected-output
12 test_begin_subtest "User-defined section with inbox tag"
13 test_emacs "(let ((notmuch-hello-sections
14 (list (lambda () (notmuch-hello-insert-searches
15 \"Test\" '((\"inbox\" . \"tag:inbox\")))))))
18 test_expect_equal_file $EXPECTED/notmuch-hello-new-section OUTPUT
20 test_begin_subtest "User-defined section with empty, hidden entry"
21 test_emacs "(let ((notmuch-hello-sections
22 (list (lambda () (notmuch-hello-insert-searches
24 '((\"inbox\" . \"tag:inbox\")
25 (\"doesnotexist\" . \"tag:doesnotexist\"))
26 :hide-empty-searches t)))))
29 test_expect_equal_file $EXPECTED/notmuch-hello-section-with-empty OUTPUT
31 test_begin_subtest "User-defined section, unread tag filtered out"
32 test_emacs "(let ((notmuch-hello-sections
33 (list (lambda () (notmuch-hello-insert-tags-section
34 \"Test-with-filtered\"
35 :hide-tags '(\"unread\"))))))
38 test_expect_equal_file $EXPECTED/notmuch-hello-section-hidden-tag OUTPUT
40 test_begin_subtest "User-defined section, different query for counts"
41 test_emacs "(let ((notmuch-hello-sections
42 (list (lambda () (notmuch-hello-insert-tags-section
44 :filter-count \"tag:signed\")))))
47 test_expect_equal_file $EXPECTED/notmuch-hello-section-counts OUTPUT
49 test_begin_subtest "Empty custom tags section"
50 test_emacs "(let* ((widget (widget-create 'notmuch-hello-tags-section))
51 (notmuch-hello-sections (list (widget-value widget))))
54 test_expect_equal_file $EXPECTED/notmuch-hello-empty-custom-tags-section OUTPUT
56 test_begin_subtest "Empty custom queries section"
57 test_emacs "(let* ((widget (widget-create 'notmuch-hello-query-section))
58 (notmuch-hello-sections (list (widget-value widget))))
61 test_expect_equal_file $EXPECTED/notmuch-hello-empty-custom-queries-section OUTPUT
63 test_begin_subtest "Column alignment for tag/queries with long names"
64 tag=a-very-long-tag # length carefully calculated for 80 characters window width
66 test_emacs '(notmuch-hello)
69 test_expect_equal_file $EXPECTED/notmuch-hello-long-names OUTPUT
71 test_begin_subtest "All tags show up"
74 notmuch config set search.exclude_tags $tag
75 test_emacs '(notmuch-hello)
78 test_expect_equal_file $EXPECTED/notmuch-hello-all-tags OUTPUT
81 test_begin_subtest "notmuch-hello with nonexistent CWD"
85 (let ((default-directory "/nonexistent"))
86 (notmuch-hello-update)))'
87 test_expect_equal "$(cat MESSAGES)" "COMPLETE"