2012-02-17 15:48:08 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2012-05-25 15:02:55 +02:00
|
|
|
test_description="emacs notmuch-hello view"
|
2017-09-25 22:38:19 +02:00
|
|
|
. $(dirname "$0")/test-lib.sh || exit 1
|
2021-05-23 09:34:43 +02:00
|
|
|
. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
|
2012-02-17 15:48:08 +01:00
|
|
|
|
2017-09-25 22:38:36 +02:00
|
|
|
EXPECTED=$NOTMUCH_SRCDIR/test/emacs.expected-output
|
2012-02-17 15:48:08 +01:00
|
|
|
|
2021-05-15 22:47:44 +02:00
|
|
|
test_require_emacs
|
2012-02-17 15:48:08 +01:00
|
|
|
add_email_corpus
|
|
|
|
|
|
|
|
test_begin_subtest "User-defined section with inbox tag"
|
|
|
|
test_emacs "(let ((notmuch-hello-sections
|
|
|
|
(list (lambda () (notmuch-hello-insert-searches
|
|
|
|
\"Test\" '((\"inbox\" . \"tag:inbox\")))))))
|
|
|
|
(notmuch-hello)
|
|
|
|
(test-output))"
|
2017-04-05 02:36:29 +02:00
|
|
|
test_expect_equal_file $EXPECTED/notmuch-hello-new-section OUTPUT
|
2012-02-17 15:48:08 +01:00
|
|
|
|
|
|
|
test_begin_subtest "User-defined section with empty, hidden entry"
|
|
|
|
test_emacs "(let ((notmuch-hello-sections
|
|
|
|
(list (lambda () (notmuch-hello-insert-searches
|
|
|
|
\"Test-with-empty\"
|
|
|
|
'((\"inbox\" . \"tag:inbox\")
|
|
|
|
(\"doesnotexist\" . \"tag:doesnotexist\"))
|
|
|
|
:hide-empty-searches t)))))
|
|
|
|
(notmuch-hello)
|
|
|
|
(test-output))"
|
2017-04-05 02:36:29 +02:00
|
|
|
test_expect_equal_file $EXPECTED/notmuch-hello-section-with-empty OUTPUT
|
2012-02-17 15:48:08 +01:00
|
|
|
|
|
|
|
test_begin_subtest "User-defined section, unread tag filtered out"
|
|
|
|
test_emacs "(let ((notmuch-hello-sections
|
|
|
|
(list (lambda () (notmuch-hello-insert-tags-section
|
|
|
|
\"Test-with-filtered\"
|
|
|
|
:hide-tags '(\"unread\"))))))
|
|
|
|
(notmuch-hello)
|
|
|
|
(test-output))"
|
2017-04-05 02:36:29 +02:00
|
|
|
test_expect_equal_file $EXPECTED/notmuch-hello-section-hidden-tag OUTPUT
|
2012-02-17 15:48:08 +01:00
|
|
|
|
|
|
|
test_begin_subtest "User-defined section, different query for counts"
|
|
|
|
test_emacs "(let ((notmuch-hello-sections
|
|
|
|
(list (lambda () (notmuch-hello-insert-tags-section
|
|
|
|
\"Test-with-counts\"
|
|
|
|
:filter-count \"tag:signed\")))))
|
|
|
|
(notmuch-hello)
|
|
|
|
(test-output))"
|
2017-04-05 02:36:29 +02:00
|
|
|
test_expect_equal_file $EXPECTED/notmuch-hello-section-counts OUTPUT
|
2012-02-17 15:48:08 +01:00
|
|
|
|
2012-05-05 16:39:46 +02:00
|
|
|
test_begin_subtest "Empty custom tags section"
|
|
|
|
test_emacs "(let* ((widget (widget-create 'notmuch-hello-tags-section))
|
|
|
|
(notmuch-hello-sections (list (widget-value widget))))
|
|
|
|
(notmuch-hello)
|
|
|
|
(test-output))"
|
2017-04-05 02:36:29 +02:00
|
|
|
test_expect_equal_file $EXPECTED/notmuch-hello-empty-custom-tags-section OUTPUT
|
2012-05-05 16:39:46 +02:00
|
|
|
|
|
|
|
test_begin_subtest "Empty custom queries section"
|
|
|
|
test_emacs "(let* ((widget (widget-create 'notmuch-hello-query-section))
|
|
|
|
(notmuch-hello-sections (list (widget-value widget))))
|
|
|
|
(notmuch-hello)
|
|
|
|
(test-output))"
|
2017-04-05 02:36:29 +02:00
|
|
|
test_expect_equal_file $EXPECTED/notmuch-hello-empty-custom-queries-section OUTPUT
|
2012-05-05 16:39:46 +02:00
|
|
|
|
2012-03-09 08:34:52 +01:00
|
|
|
test_begin_subtest "Column alignment for tag/queries with long names"
|
|
|
|
tag=a-very-long-tag # length carefully calculated for 80 characters window width
|
|
|
|
notmuch tag +$tag '*'
|
|
|
|
test_emacs '(notmuch-hello)
|
|
|
|
(test-output)'
|
|
|
|
notmuch tag -$tag '*'
|
2017-04-05 02:36:29 +02:00
|
|
|
test_expect_equal_file $EXPECTED/notmuch-hello-long-names OUTPUT
|
2012-03-09 08:34:52 +01:00
|
|
|
|
2022-01-05 02:06:04 +01:00
|
|
|
test_begin_subtest "All tags show up"
|
|
|
|
tag=exclude_me
|
|
|
|
notmuch tag +$tag '*'
|
|
|
|
notmuch config set search.exclude_tags $tag
|
|
|
|
test_emacs '(notmuch-hello)
|
|
|
|
(test-output)'
|
|
|
|
notmuch tag -$tag '*'
|
|
|
|
test_expect_equal_file $EXPECTED/notmuch-hello-all-tags OUTPUT
|
|
|
|
|
|
|
|
test_done
|
2021-08-29 21:23:28 +02:00
|
|
|
test_begin_subtest "notmuch-hello with nonexistent CWD"
|
|
|
|
test_emacs '
|
|
|
|
(notmuch-hello)
|
|
|
|
(test-log-error
|
|
|
|
(let ((default-directory "/nonexistent"))
|
|
|
|
(notmuch-hello-update)))'
|
|
|
|
test_expect_equal "$(cat MESSAGES)" "COMPLETE"
|
|
|
|
|
2012-02-17 15:48:08 +01:00
|
|
|
test_done
|