]> diplodocus.org Git - nmh/blob - test/mhl/test-mhl-flags
Added start_test/finish_test to a bunch of tests.
[nmh] / test / mhl / test-mhl-flags
1 #!/bin/sh
2 #
3 # Test of various (well, start with one) function escapes.
4
5 set -e
6
7 if test -z "${MH_OBJ_DIR}"; then
8 srcdir=`dirname "$0"`/../..
9 MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
10 fi
11
12 . "$MH_OBJ_DIR/test/common.sh"
13
14 setup_test
15 mhl="${MH_LIBEXEC_DIR}/mhl"
16
17 MHLDEBUG=foo check_exit '-eq 1' "$mhl" -
18 unset MHLDEBUG
19 check_exit '-eq 1' "$mhl" -xyzzy
20 check_exit '-eq 0' "$mhl" -help
21 check_exit '-eq 0' "$mhl" -version
22 check_exit '-eq 1' "$mhl" -bell -nobell -clear -
23 check_exit '-eq 1' "$mhl" -folder
24 check_exit '-eq 1' "$mhl" -folder + -
25 check_exit '-eq 1' "$mhl" -form
26 check_exit '-eq 1' "$mhl" -sleep
27 check_exit '-eq 1' "$mhl" -sleep 42 -
28 check_exit '-eq 1' "$mhl" -moreproc foo -moreproc
29 check_exit '-eq 1' "$mhl" -nofmtproc -fmtproc foo -fmtproc
30 check_exit '-eq 1' "$mhl" -length 42 -length
31 check_exit '-eq 1' "$mhl" -length 0
32 check_exit '-eq 1' "$mhl" -width
33 check_exit '-eq 1' "$mhl" -digest foo -width 0
34 check_exit '-eq 1' "$mhl" -issue 42 -digest
35 check_exit '-eq 1' "$mhl" -issue
36 check_exit '-eq 1' "$mhl" -volume 42 -issue 0
37 check_exit '-eq 1' "$mhl" -volume
38 check_exit '-eq 1' "$mhl" -forwall -volume 0
39 check_exit '-eq 0' "$mhl" -dashstuffing -nodashstuffing \
40 -forwall </dev/null
41 check_exit '-eq 0' "$mhl" -forwall -digest foo \
42 -bell -length 1 -width 1 </dev/null
43 check_exit '-eq 0' "$mhl" -forwall -digest foo \
44 -nobell -volume 1 -clear </dev/null
45
46 expected="$MH_TEST_DIR/$$.expected"
47 actual="$MH_TEST_DIR/$$.actual"
48
49 cat >`mhpath new` <<EOF
50 MIME-Version: 1.0
51 From: sender@example.com
52 To: recipient@example.com
53 Subject: message with blank lines and trailing spaces
54 Date: Mon, 29 Apr 2013 11:51:45 -0400
55
56 There are two blank lines below. And there is a trailing space:
57 And another trailing space:
58
59
60 EOF
61
62
63 # check nortrim (default), and that trailing whitespace in a
64 start_test "nortrim (default), and that trailing whitespace in a"
65 # component is trimmed when filtering blank lines
66 cat >"$expected" <<EOF
67 > There are two blank lines below. And there is a trailing space:
68 > And another trailing space:
69 >
70 >
71 EOF
72
73 cat >"$MH_TEST_DIR/test.format" <<EOF
74 body:component="> "
75 EOF
76
77 "$mhl" -nomoreproc -form "$MH_TEST_DIR/test.format" `mhpath last` >"$actual"
78 check "$expected" "$actual"
79
80
81 # check rtrim
82 start_test "rtrim"
83 cat >"$expected" <<EOF
84 > There are two blank lines below. And there is a trailing space:
85 > And another trailing space:
86 >
87 >
88 EOF
89
90 cat >"$MH_TEST_DIR/test.format" <<EOF
91 body:component="> ",rtrim
92 EOF
93
94 "$mhl" -nomoreproc -form "$MH_TEST_DIR/test.format" `mhpath last` >"$actual"
95 check "$expected" "$actual"
96
97
98 rm -f "$MH_TEST_DIR/test.format"
99
100 finish_test
101 exit $failed