Added "-d --" to invocation of ls when figuring out what files
[mmh] / test / mhshow / test-subpart
1 #!/bin/sh
2 ######################################################
3 #
4 # Test show of one part, fixed by
5 # 31cba404636730df219dd009ca5893ccc56d46af
6 #
7 ######################################################
8
9 set -e
10
11 if test -z "${MH_OBJ_DIR}"; then
12     srcdir=`dirname "$0"`/../..
13     MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
14 fi
15
16 . "$MH_OBJ_DIR/test/common.sh"
17
18 setup_test
19
20 expected=$MH_TEST_DIR/$$.expected
21 actual=$MH_TEST_DIR/$$.actual
22
23 # Write message with a text/plain subpart.
24 msgfile=`mhpath new`
25 msgnum=`basename $msgfile`
26 cat > $msgfile <<EOF
27 MIME-Version: 1.0
28 Content-Type: multipart/mixed; boundary="NextPart_001"
29 Content-class: urn:content-classes:message
30 Date: Thu, 19 May 2011 00:00:00 -0000
31 From: sender@example.com
32 To: recipient@example.com
33
34 This is a multi-part message in MIME format.
35
36 --NextPart_001
37 Content-Type: multipart/related;
38     type="multipart/alternative";
39     boundary="NextPart_002"
40
41 --NextPart_002
42 Content-Type: text/plain;
43     charset="utf-8"
44
45 This is the text/plain part.
46
47 --NextPart_002--
48
49 --NextPart_001--
50 EOF
51
52 # Write the expected output.
53 cat > $expected <<EOF
54 part 1.1   text/plain                  29
55 This is the text/plain part.
56 EOF
57
58 # check it
59 mhshow -part 1.1 -form mhl.null -nopause $msgnum > $actual 2>&1
60 check "$expected" "$actual"
61
62 exit $failed