]> diplodocus.org Git - nmh/blob - test/mhl/test-mhl-flags
h/prototypes.h: Remove duplicate prototype for pwd().
[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 # component is trimmed when filtering blank lines
65 cat >"$expected" <<EOF
66 > There are two blank lines below. And there is a trailing space:
67 > And another trailing space:
68 >
69 >
70 EOF
71
72 cat >"$MH_TEST_DIR/test.format" <<EOF
73 body:component="> "
74 EOF
75
76 "$mhl" -nomoreproc -form "$MH_TEST_DIR/test.format" `mhpath last` >"$actual"
77 check "$expected" "$actual"
78
79
80 # check rtrim
81 cat >"$expected" <<EOF
82 > There are two blank lines below. And there is a trailing space:
83 > And another trailing space:
84 >
85 >
86 EOF
87
88 cat >"$MH_TEST_DIR/test.format" <<EOF
89 body:component="> ",rtrim
90 EOF
91
92 "$mhl" -nomoreproc -form "$MH_TEST_DIR/test.format" `mhpath last` >"$actual"
93 check "$expected" "$actual"
94
95
96 rm -f "$MH_TEST_DIR/test.format"
97
98 exit $failed