]> git.notmuchmail.org Git - notmuch/blob - test/T454-emacs-dont-reply-names.sh
emacs: Add new option notmuch-search-hide-excluded
[notmuch] / test / T454-emacs-dont-reply-names.sh
1 #!/usr/bin/env bash
2
3 test_description="message-dont-reply-to-names in emacs replies"
4 . $(dirname "$0")/test-lib.sh || exit 1
5 . $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
6
7 EXPECTED=$NOTMUCH_SRCDIR/test/emacs-show.expected-output
8
9 test_require_emacs
10
11 add_email_corpus default
12
13 test_begin_subtest "regular expression"
14 test_emacs '(let ((message-dont-reply-to-names "notmuchmail\\|noreply\\|harvard"))
15               (notmuch-mua-new-reply
16                 "id:20091117203301.GV3165@dottiness.seas.harvard.edu" nil t)
17               (test-visible-output "OUTPUT-FULL.raw"))'
18
19 notmuch_dir_sanitize < OUTPUT-FULL.raw > OUTPUT-FULL
20 head -6 OUTPUT-FULL > OUTPUT
21
22 cat <<EOF > EXPECTED
23 From: Notmuch Test Suite <test_suite@notmuchmail.org>
24 To: Mikhail Gusarov <dottedmag@dottedmag.net>
25 Subject: Re: [notmuch] Working with Maildir storage?
26 In-Reply-To: <20091117203301.GV3165@dottiness.seas.harvard.edu>
27 Fcc: MAIL_DIR/sent
28 --text follows this line--
29 EOF
30
31 test_expect_equal_file EXPECTED OUTPUT
32
33 test_begin_subtest "predicate"
34 test_emacs '(let ((message-dont-reply-to-names
35                    (lambda (m) (string-prefix-p "Mikhail" m))))
36               (notmuch-mua-new-reply
37                 "id:20091117203301.GV3165@dottiness.seas.harvard.edu" nil t)
38               (test-visible-output "OUTPUT-FULL-PRED.raw"))'
39
40 notmuch_dir_sanitize < OUTPUT-FULL-PRED.raw > OUTPUT-FULL-PRED
41 head -7 OUTPUT-FULL-PRED > OUTPUT-PRED
42
43 cat <<EOF > EXPECTED-PRED
44 From: Notmuch Test Suite <test_suite@notmuchmail.org>
45 To: Lars Kellogg-Stedman <lars@seas.harvard.edu>
46 Cc: notmuch@notmuchmail.org
47 Subject: Re: [notmuch] Working with Maildir storage?
48 In-Reply-To: <20091117203301.GV3165@dottiness.seas.harvard.edu>
49 Fcc: MAIL_DIR/sent
50 --text follows this line--
51 EOF
52
53 test_expect_equal_file EXPECTED-PRED OUTPUT-PRED
54
55 test_begin_subtest "nil value"
56 test_emacs '(let ((message-dont-reply-to-names nil))
57               (notmuch-mua-new-reply
58                 "id:20091117203301.GV3165@dottiness.seas.harvard.edu" nil t)
59               (test-visible-output "OUTPUT-FULL-NIL.raw"))'
60
61 notmuch_dir_sanitize < OUTPUT-FULL-NIL.raw > OUTPUT-FULL-NIL
62 head -7 OUTPUT-FULL-NIL > OUTPUT-NIL
63
64 cat <<EOF > EXPECTED-NIL
65 From: Notmuch Test Suite <test_suite@notmuchmail.org>
66 To: Lars Kellogg-Stedman <lars@seas.harvard.edu>, Mikhail Gusarov <dottedmag@dottedmag.net>
67 Cc: notmuch@notmuchmail.org
68 Subject: Re: [notmuch] Working with Maildir storage?
69 In-Reply-To: <20091117203301.GV3165@dottiness.seas.harvard.edu>
70 Fcc: MAIL_DIR/sent
71 --text follows this line--
72 EOF
73
74 test_expect_equal_file EXPECTED-NIL OUTPUT-NIL
75
76 test_done