]> git.notmuchmail.org Git - notmuch/blob - test/T465-emacs-unthreaded.sh
emacs: Add new option notmuch-search-hide-excluded
[notmuch] / test / T465-emacs-unthreaded.sh
1 #!/usr/bin/env bash
2
3 test_description="emacs unthreaded interface"
4 . $(dirname "$0")/test-lib.sh || exit 1
5 . $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
6
7 test_require_emacs
8
9 EXPECTED=$NOTMUCH_SRCDIR/test/emacs-unthreaded.expected-output
10
11 generate_message "[id]=large-thread-1" '[subject]="large thread"'
12 printf "  2001-01-05  Notmuch Test Suite   large thread%43s(inbox unread)\n" >> EXPECTED.unthreaded
13
14 for num in $(seq 2 64); do
15     prev=$((num - 1))
16     generate_message '[subject]="large thread"' "[id]=large-thread-$num" "[in-reply-to]=\<large-thread-$prev\>"
17     printf "  2001-01-05  Notmuch Test Suite   large thread%43s(inbox unread)\n" >> EXPECTED.unthreaded
18 done
19 printf "End of search results.\n" >> EXPECTED.unthreaded
20
21 notmuch new > new.output 2>&1
22
23 test_begin_subtest "large thread"
24 test_emacs '(let ((max-lisp-eval-depth 10))
25               (notmuch-unthreaded "subject:large-thread")
26               (notmuch-test-wait)
27               (test-output))'
28 test_expect_equal_file EXPECTED.unthreaded OUTPUT
29
30 test_begin_subtest "message from large thread (status)"
31 output=$(test_emacs '(let ((max-lisp-eval-depth 10))
32                        (notmuch-unthreaded "subject:large-thread")
33                        (notmuch-test-wait)
34                        (notmuch-tree-show-message nil)
35                        (notmuch-test-wait)
36                        "SUCCESS")' )
37 test_expect_equal "$output" '"SUCCESS"'
38
39 add_email_corpus
40 test_begin_subtest "Functions in unthreaded-result-format"
41 test_emacs '
42 (let
43     ((notmuch-unthreaded-result-format
44      (quote (("date" . "%12s  ")
45              ("authors" . "%-20s")
46              ("subject" . "%-54s")
47              (notmuch-test-result-flags . "(%s)")))))
48   (notmuch-unthreaded "tag:inbox")
49   (notmuch-test-wait)
50   (test-output))
51 '
52 test_expect_equal_file $EXPECTED/result-format-function OUTPUT
53
54 test_begin_subtest "notmuch-unthreaded with nonexistent CWD"
55 test_emacs '(test-log-error
56               (let ((default-directory "/nonexistent"))
57                 (notmuch-unthreaded "*")))'
58 test_expect_equal "$(cat MESSAGES)" "COMPLETE"
59
60 test_done