]> diplodocus.org Git - nmh/blob - test/mhbuild/test-mhbuild
Tell make that uip/mhical.c depends on sbr/icalparse.h
[nmh] / test / mhbuild / test-mhbuild
1 #!/bin/sh
2 ######################################################
3 #
4 # Basic mhbuild tests.
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 expected="$MH_TEST_DIR/test-mhbuild$$.expected"
18
19 start_test "-nodirectives"
20 cat >"$expected" <<'EOF'
21 Subject: test -nodirectives
22 MIME-Version: 1.0
23 Content-Type: text/plain; charset="us-ascii"
24
25 #define line begins with # and ends with backslash-newline \
26 all characters should be preserved
27 EOF
28
29 cat >"`mhpath new`" <<'EOF'
30 Subject: test -nodirectives
31 --------
32 #define line begins with # and ends with backslash-newline \
33 all characters should be preserved
34 EOF
35
36 run_test "mhbuild -nodirectives `mhpath last`"
37 check "`mhpath last`" "$expected"
38
39 start_test "Checking for MIME-Version handling in draft"
40
41 cat > "`mhpath new`" <<'EOF'
42 From: Somebody <somebody@example.com>
43 To: Nobody <nobody@example.com>
44 Subject: Test message
45 MIME-Version: 1.0
46 --------
47 This is a test
48 EOF
49
50 cat >"$expected" <<'EOF'
51 From: Somebody <somebody@example.com>
52 To: Nobody <nobody@example.com>
53 Subject: Test message
54 MIME-Version: 1.0
55 --------
56 This is a test
57 EOF
58
59 run_test "mhbuild `mhpath last`" "mhbuild: draft shouldn't contain MIME-Version: field"
60 check "`mhpath last`" "$expected" 'keep first'
61
62 cat >"$expected" <<'EOF'
63 From: Somebody <somebody@example.com>
64 To: Nobody <nobody@example.com>
65 Subject: Test message
66 MIME-Version: 1.0
67 --------
68 This is a test
69 EOF
70
71 run_test "mhbuild -auto `mhpath last`"
72 check "`mhpath last`" "$expected"
73
74 start_test "Checking for arbitrary Content header handling in draft"
75
76 cat > "`mhpath new`" <<'EOF'
77 From: Somebody <somebody@example.com>
78 To: Nobody <nobody@example.com>
79 Subject: Test message
80 Content-Fart: nothing
81 --------
82 This is a test
83 EOF
84
85 cat >"$expected" <<'EOF'
86 From: Somebody <somebody@example.com>
87 To: Nobody <nobody@example.com>
88 Subject: Test message
89 Content-Fart: nothing
90 --------
91 This is a test
92 EOF
93
94 run_test "mhbuild `mhpath last`" "mhbuild: draft shouldn't contain Content-Fart: field"
95 check "`mhpath last`" "$expected" 'keep first'
96
97 cat >"$expected" <<'EOF'
98 From: Somebody <somebody@example.com>
99 To: Nobody <nobody@example.com>
100 Subject: Test message
101 Content-Fart: nothing
102 --------
103 This is a test
104 EOF
105
106 run_test "mhbuild -auto `mhpath last`" "mhbuild: draft shouldn't contain Content-Fart: field"
107 check "`mhpath last`" "$expected"
108
109 start_test "Checking for out-of-order Content header handling in draft"
110
111 cat > "`mhpath new`" <<'EOF'
112 From: Somebody <somebody@example.com>
113 To: Nobody <nobody@example.com>
114 Subject: Test message
115 Content-Fart: nothing
116 MIME-Version: 1.0
117 --------
118 This is a test
119 EOF
120
121 cat >"$expected" <<'EOF'
122 From: Somebody <somebody@example.com>
123 To: Nobody <nobody@example.com>
124 Subject: Test message
125 Content-Fart: nothing
126 MIME-Version: 1.0
127 --------
128 This is a test
129 EOF
130
131 run_test "mhbuild `mhpath last`" "mhbuild: draft shouldn't contain MIME-Version: field"
132 check "`mhpath last`" "$expected" 'keep first'
133
134 cat >"$expected" <<'EOF'
135 From: Somebody <somebody@example.com>
136 To: Nobody <nobody@example.com>
137 Subject: Test message
138 Content-Fart: nothing
139 MIME-Version: 1.0
140 --------
141 This is a test
142 EOF
143
144 run_test "mhbuild -auto `mhpath last`"
145 check "`mhpath last`" "$expected"
146
147 finish_test
148 exit $failed