]> diplodocus.org Git - nmh/blob - test/repl/test-convert
In expand_pseudoheader(), set Content-Type to 7-bit for ASCII text.
[nmh] / test / repl / test-convert
1 #!/bin/sh
2 ######################################################
3 #
4 # Test repl -convertarg
5 #
6 ######################################################
7
8 set -e
9
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir=`dirname $0`/../..
12 MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
13 fi
14
15 . "${srcdir}/test/post/test-post-common.sh"
16
17 expected="$MH_TEST_DIR/test-convert$$.expected"
18 actual=`mhpath +`/draft
19
20 printf 'Local-Mailbox: recipient@example.com' >>"$MH"
21
22
23 # check -convertarg with multiple parts and no additional text in draft
24 cat >"$expected" <<'EOF'
25 From: recipient@example.com
26 To: sender@example.com
27 cc:
28 Fcc: +outbox
29 Subject: Re: test
30 Comments: In-reply-to sender@example.com
31 message dated "Thu, 11 Dec 2014 08:19:02 -0600."
32 MIME-Version: 1.0
33 Content-Type: text/plain; charset="US-ASCII"
34
35 > This is part 1.
36
37 > This is part 2.
38 EOF
39
40 cat >`mhpath new` <<'EOF'
41 From: sender@example.com
42 To: recipient@example.com
43 Subject: test
44 Date: Thu, 11 Dec 2014 08:19:02 -0600
45 Content-Type: multipart/mixed; boundary="_001_"
46 MIME-Version: 1.0
47
48 --_001_
49 Content-Type: text/plain
50
51 This is part 1.
52
53 --_001_
54 Content-Type: text/plain
55
56 This is part 2.
57
58 --_001_
59 Content-Type: text/enriched
60
61 This should not appear in the reply
62 because the content type isn't matched.
63
64 --_001_--
65 EOF
66
67 repl -noformat -convertarg text/plain '' -nowhatnowproc last
68 mhbuild "$actual"
69 check "$actual" "$expected"
70
71
72 #### Make sure that this works with 8-bit encoding.
73 require_locale en_US.utf-8 en_US.utf8
74 LC_ALL=en_US.UTF-8; export LC_ALL
75
76
77 # check -convertarg with multiple parts and additional text in draft
78 cat >"$expected" <<'EOF'
79 From: recipient@example.com
80 To: sender@example.com
81 cc:
82 Fcc: +outbox
83 Subject: Re: test
84 Comments: In-reply-to sender@example.com
85 message dated "Thu, 11 Dec 2014 08:19:02 -0600."
86 MIME-Version: 1.0
87 Content-Type: text/plain; charset="UTF-8"
88 Content-Transfer-Encoding: 8bit
89
90 sender@example.com writes:
91
92 > This is part 1.
93
94 > This is part 2.
95 EOF
96
97 cat >`mhpath new` <<'EOF'
98 From: sender@example.com
99 To: recipient@example.com
100 Subject: test
101 Date: Thu, 11 Dec 2014 08:19:02 -0600
102 Content-Type: multipart/mixed; boundary="_001_"
103 MIME-Version: 1.0
104
105 --_001_
106 Content-Type: text/plain
107
108 This is part 1.
109
110 --_001_
111 Content-Type: text/plain
112
113 This is part 2.
114
115 --_001_--
116 EOF
117
118 repl -filter mhl.replywithoutbody -convertarg text/plain '' -nowhatnowproc last
119 mhbuild "$actual"
120 check "$actual" "$expected"
121
122
123 exit $failed