3 test_description="emacs unthreaded interface"
4 . $(dirname "$0")/test-lib.sh || exit 1
5 . $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
9 EXPECTED=$NOTMUCH_SRCDIR/test/emacs-unthreaded.expected-output
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
14 for num in $(seq 2 64); do
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
19 printf "End of search results.\n" >> EXPECTED.unthreaded
21 notmuch new > new.output 2>&1
23 test_begin_subtest "large thread"
24 test_emacs '(let ((max-lisp-eval-depth 10))
25 (notmuch-unthreaded "subject:large-thread")
28 test_expect_equal_file EXPECTED.unthreaded OUTPUT
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")
34 (notmuch-tree-show-message nil)
37 test_expect_equal "$output" '"SUCCESS"'
40 test_begin_subtest "Functions in unthreaded-result-format"
43 ((notmuch-unthreaded-result-format
44 (quote (("date" . "%12s ")
47 (notmuch-test-result-flags . "(%s)")))))
48 (notmuch-unthreaded "tag:inbox")
52 test_expect_equal_file $EXPECTED/result-format-function OUTPUT
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"
60 add_email_corpus duplicate
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}\")
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"
75 test_begin_subtest "duplicate=4"
76 test_emacs "(let ((notmuch-tree-show-out t))
77 (notmuch-unthreaded \"id:${ID3}\")
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