]> git.cworth.org Git - notmuch/blob - test/T465-emacs-unthreaded.sh
emacs/show: display count of duplicates in headerline
[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 add_email_corpus duplicate
61
62 ID3=87r2ecrr6x.fsf@zephyr.silentflame.com
63 test_begin_subtest "duplicate=3, subject"
64 test_emacs "(let ((notmuch-tree-show-out t))
65               (notmuch-unthreaded \"id:${ID3}\")
66               (notmuch-test-wait)
67               (notmuch-tree-show-message nil)
68               (notmuch-show-choose-duplicate 3)
69               (test-visible-output \"OUTPUT\"))"
70 output=$(grep "Subject:" OUTPUT)
71 file=$(notmuch search --output=files id:${ID3} | head -n 3 | tail -n 1)
72 subject=$(grep '^Subject:' $file)
73 test_expect_equal "$output" "$subject"
74
75 test_begin_subtest "duplicate=4"
76 test_emacs "(let ((notmuch-tree-show-out t))
77               (notmuch-unthreaded \"id:${ID3}\")
78               (notmuch-test-wait)
79               (notmuch-tree-show-message nil)
80               (notmuch-show-choose-duplicate 4)
81               (test-visible-output \"OUTPUT\"))"
82 test_expect_equal_file_nonempty $NOTMUCH_SRCDIR/test/emacs-show.expected-output/notmuch-show-duplicate-4 OUTPUT
83
84
85 test_done