]> git.cworth.org Git - notmuch-old/blob - test/T440-emacs-hello.sh
debian: upload release candidate to experimental, not unstable
[notmuch-old] / test / T440-emacs-hello.sh
1 #!/usr/bin/env bash
2
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
6
7 EXPECTED=$NOTMUCH_SRCDIR/test/emacs.expected-output
8
9 test_require_emacs
10 add_email_corpus
11
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\")))))))
16            (notmuch-hello)
17            (test-output))"
18 test_expect_equal_file $EXPECTED/notmuch-hello-new-section OUTPUT
19
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
23                                      \"Test-with-empty\"
24                                      '((\"inbox\" . \"tag:inbox\")
25                                        (\"doesnotexist\" . \"tag:doesnotexist\"))
26                                      :hide-empty-searches t)))))
27              (notmuch-hello)
28              (test-output))"
29 test_expect_equal_file $EXPECTED/notmuch-hello-section-with-empty OUTPUT
30
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\"))))))
36              (notmuch-hello)
37              (test-output))"
38 test_expect_equal_file $EXPECTED/notmuch-hello-section-hidden-tag OUTPUT
39
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
43                                      \"Test-with-counts\"
44                                      :filter-count \"tag:signed\")))))
45              (notmuch-hello)
46              (test-output))"
47 test_expect_equal_file $EXPECTED/notmuch-hello-section-counts OUTPUT
48
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))))
52              (notmuch-hello)
53              (test-output))"
54 test_expect_equal_file $EXPECTED/notmuch-hello-empty-custom-tags-section OUTPUT
55
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))))
59              (notmuch-hello)
60              (test-output))"
61 test_expect_equal_file $EXPECTED/notmuch-hello-empty-custom-queries-section OUTPUT
62
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
65 notmuch tag +$tag '*'
66 test_emacs '(notmuch-hello)
67             (test-output)'
68 notmuch tag -$tag '*'
69 test_expect_equal_file $EXPECTED/notmuch-hello-long-names OUTPUT
70
71 test_begin_subtest "All tags show up"
72 tag=exclude_me
73 notmuch tag +$tag '*'
74 notmuch config set search.exclude_tags $tag
75 test_emacs '(notmuch-hello)
76             (test-output)'
77 notmuch tag -$tag '*'
78 test_expect_equal_file $EXPECTED/notmuch-hello-all-tags OUTPUT
79
80 test_done
81 test_begin_subtest "notmuch-hello with nonexistent CWD"
82 test_emacs '
83       (notmuch-hello)
84       (test-log-error
85         (let ((default-directory "/nonexistent"))
86           (notmuch-hello-update)))'
87 test_expect_equal "$(cat MESSAGES)" "COMPLETE"
88
89 test_done