c19a34353c0ae003930512c4b61bc75e92605310
[mmh] / test / mhshow / test-qp
1 #!/bin/sh
2 ######################################################
3 #
4 # Test quoted-printable decoding.
5 #
6 ######################################################
7
8 set -e
9
10 if [ -z "${MH_TEST_COMMON}" ]; then
11     echo "MH_TEST_COMMON not set; try running via 'make check'"
12 fi
13
14 . ${MH_TEST_COMMON}
15
16 setup_test
17
18 expected=$MH_TEST_DIR/$$.expected
19 actual=$MH_TEST_DIR/$$.actual
20
21 # Write message with bogus quoted-printable data.
22 msgfile=$(mhpath new)
23 msgnum=$(basename $msgfile)
24 cat > $msgfile <<EOF
25 From: foo@example.edu
26 To: bar@example.edu
27 Subject: test
28 MIME-Version: 1.0
29 Content-Transfer-Encoding: quoted-printable
30 Date: Sun, 18 Dec 2005 00:52:39 +0100
31
32 =3D
33 =3d
34 ignored space at end 
35 ignored tab at end      
36 just a newline =
37
38 ==3d ====3D
39 =       just a tab
40 = just a space
41 =cl
42 =l with a space
43 =l
44 =\b ^H (backspace) character, probably erased = in diff output
45 EOF
46
47 # check it
48 cat > $expected <<EOF
49 Date:    Sun, 18 Dec 2005 00:52:39 +0100
50 To:      bar@example.edu
51 From:    foo@example.edu
52 Subject: test
53
54 MIME-Version: 1.0
55
56 part       text/plain                 181
57 =
58 =
59 ignored space at end
60 ignored tab at end
61 just a newline 
62 == ====
63 =       just a tab
64 = just a space
65 =cl
66 =l with a space
67 =l
68 =\b ^H (backspace) character, probably erased = in diff output
69 EOF
70 mhshow -nopause $msgnum > $actual 2>&1
71 diff -u $expected $actual