]> git.notmuchmail.org Git - notmuch/blob - test/T440-emacs-hello.sh
Import notmuch_0.27.orig.tar.gz
[notmuch] / 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
6 EXPECTED=$NOTMUCH_SRCDIR/test/emacs.expected-output
7
8 add_email_corpus
9
10 test_begin_subtest "User-defined section with inbox tag"
11 test_emacs "(let ((notmuch-hello-sections
12                    (list (lambda () (notmuch-hello-insert-searches
13                                      \"Test\" '((\"inbox\" . \"tag:inbox\")))))))
14            (notmuch-hello)
15            (test-output))"
16 test_expect_equal_file $EXPECTED/notmuch-hello-new-section OUTPUT
17
18 test_begin_subtest "User-defined section with empty, hidden entry"
19 test_emacs "(let ((notmuch-hello-sections
20                    (list (lambda () (notmuch-hello-insert-searches
21                                      \"Test-with-empty\"
22                                      '((\"inbox\" . \"tag:inbox\")
23                                        (\"doesnotexist\" . \"tag:doesnotexist\"))
24                                      :hide-empty-searches t)))))
25              (notmuch-hello)
26              (test-output))"
27 test_expect_equal_file $EXPECTED/notmuch-hello-section-with-empty OUTPUT
28
29 test_begin_subtest "User-defined section, unread tag filtered out"
30 test_emacs "(let ((notmuch-hello-sections
31                    (list (lambda () (notmuch-hello-insert-tags-section
32                                      \"Test-with-filtered\"
33                                      :hide-tags '(\"unread\"))))))
34              (notmuch-hello)
35              (test-output))"
36 test_expect_equal_file $EXPECTED/notmuch-hello-section-hidden-tag OUTPUT
37
38 test_begin_subtest "User-defined section, different query for counts"
39 test_emacs "(let ((notmuch-hello-sections
40                    (list (lambda () (notmuch-hello-insert-tags-section
41                                      \"Test-with-counts\"
42                                      :filter-count \"tag:signed\")))))
43              (notmuch-hello)
44              (test-output))"
45 test_expect_equal_file $EXPECTED/notmuch-hello-section-counts OUTPUT
46
47 test_begin_subtest "Empty custom tags section"
48 test_emacs "(let* ((widget (widget-create 'notmuch-hello-tags-section))
49                    (notmuch-hello-sections (list (widget-value widget))))
50              (notmuch-hello)
51              (test-output))"
52 test_expect_equal_file $EXPECTED/notmuch-hello-empty-custom-tags-section OUTPUT
53
54 test_begin_subtest "Empty custom queries section"
55 test_emacs "(let* ((widget (widget-create 'notmuch-hello-query-section))
56                    (notmuch-hello-sections (list (widget-value widget))))
57              (notmuch-hello)
58              (test-output))"
59 test_expect_equal_file $EXPECTED/notmuch-hello-empty-custom-queries-section OUTPUT
60
61 test_begin_subtest "Column alignment for tag/queries with long names"
62 tag=a-very-long-tag # length carefully calculated for 80 characters window width
63 notmuch tag +$tag '*'
64 test_emacs '(notmuch-hello)
65             (test-output)'
66 notmuch tag -$tag '*'
67 test_expect_equal_file $EXPECTED/notmuch-hello-long-names OUTPUT
68
69 test_done