]> diplodocus.org Git - nmh/blob - test/mhbuild/test-attach
Added -v and -a switches to whatnow attach so the user can see
[nmh] / test / mhbuild / test-attach
1 #!/bin/sh
2 ######################################################
3 #
4 # Test the use of the Attach: header
5 #
6 ######################################################
7
8 if test -z "${MH_OBJ_DIR}"; then
9 srcdir=`dirname "$0"`/../..
10 MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
11 fi
12
13 . "$MH_OBJ_DIR/test/common.sh"
14
15 setup_test
16
17 draft="$MH_TEST_DIR/$$.draft"
18 expected="$MH_TEST_DIR/$$.expected"
19 actual="$MH_TEST_DIR/$$.actual"
20
21 #
22 # Test out a simple draft, one part.
23 #
24
25 cat > "$draft" <<EOF
26 To: Mr Test <mrtest@example.com>
27 cc:
28 Fcc: +outbox
29 Attach: ${srcdir}/test/mhbuild/tiny.jpg
30 ------
31 EOF
32
33 mhbuild "$draft"
34
35 cat > "$actual" <<EOF
36 To: Mr Test <mrtest@example.com>
37 cc:
38 Fcc: +outbox
39 MIME-Version: 1.0
40 Content-Type: image/jpeg; name="tiny.jpg"
41 Content-Description: tiny.jpg
42 Content-Disposition: attachment; filename="tiny.jpg"
43 Content-Transfer-Encoding: base64
44
45 /9g=
46 EOF
47
48 check "$draft" "$actual"
49
50 #
51 # Check out more common case, one (or more) attachments
52 # along with message text.
53 #
54
55 cat > "$draft" <<EOF
56 To: Mr Test <mrtest@example.com>
57 cc:
58 Fcc: +outbox
59 Attach: ${srcdir}/test/mhbuild/tiny.jpg
60 ------
61 This is a test
62 EOF
63
64 mhbuild "$draft"
65
66 cat "$draft"
67
68 #
69 # Two parts, one attachment
70 #
71
72 exit ${failed:-0}