Rearranged test suite environment variables so that individual tests
[mmh] / test / mhshow / test-qp
1 #!/bin/sh
2 ######################################################
3 #
4 # Test quoted-printable decoding.
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 . "$MH_OBJ_DIR/test/common.sh"
16
17 setup_test
18
19 expected=$MH_TEST_DIR/$$.expected
20 actual=$MH_TEST_DIR/$$.actual
21
22 # Write message with bogus quoted-printable data.
23 msgfile=$(mhpath new)
24 msgnum=$(basename $msgfile)
25 cat > $msgfile <<EOF
26 From: foo@example.edu
27 To: bar@example.edu
28 Subject: test
29 MIME-Version: 1.0
30 Content-Transfer-Encoding: quoted-printable
31 Date: Sun, 18 Dec 2005 00:52:39 +0100
32
33 =3D
34 =3d
35 ignored space at end 
36 ignored tab at end      
37 just a newline =
38
39 ==3d ====3D
40 =       just a tab
41 = just a space
42 =cl
43 =l with a space
44 =l
45 =\b ^H (backspace) character, probably erased = in diff output
46 EOF
47
48 # check it
49 cat > $expected <<EOF
50 Date:    Sun, 18 Dec 2005 00:52:39 +0100
51 To:      bar@example.edu
52 From:    foo@example.edu
53 Subject: test
54
55 MIME-Version: 1.0
56
57 part       text/plain                 181
58 =
59 =
60 ignored space at end
61 ignored tab at end
62 just a newline 
63 == ====
64 =       just a tab
65 = just a space
66 =cl
67 =l with a space
68 =l
69 =\b ^H (backspace) character, probably erased = in diff output
70 EOF
71 mhshow -nopause $msgnum > $actual 2>&1
72 diff -u $expected $actual