c2fc5deccb4a25bec2e4d53fe8f9cc2f3c69fbd5
[mmh] / test / tests / mhparam / test-mhparam
1 #!/bin/sh
2 ######################################################
3 #
4 # Test mhparam
5 #
6 ######################################################
7
8
9 . "$MH_TEST_COMMON"
10
11
12 # check -help
13 runandcheck "mhparam -help" <<!
14 Usage: mhparam [profile-components] [switches]
15   switches are:
16   -[no]components
17   -all
18   -Version
19   -help
20 !
21
22
23 # check -version
24 case `mhparam -V` in
25   mhparam\ --*) ;;
26   *           ) echo "$0: mhparam -v generated unexpected output" 1>&2
27                 failed=`expr ${failed:-0} + 1`;;
28 esac
29
30 # check unknown option
31 runandcheck 'mhparam -nonexistent' <<!
32 mhparam: -nonexistent unknown
33 !
34
35 # check -all
36 cp "$MMH/profile" "$MMH/profile2"
37
38 MMHP="$MMH/profile2"
39 export MMHP
40
41 # -all adds current folder
42 runandcheck "mhparam -all" <<!
43 Path: $MH_TEST_DIR/Mail
44 Inbox: +inbox
45 Current-Folder: inbox
46 !
47
48
49 # check -all with a component
50 runandcheck "mhparam -all path >/dev/null" <<!
51 mhparam: profile-components ignored with -all
52 !
53
54 # check -all with -components
55 runandcheck "mhparam -all -components >/dev/null" <<!
56 mhparam: -components ignored with -all
57 !
58
59 # check one component
60 runandcheck 'mhparam path' <<!
61 $MH_TEST_DIR/Mail
62 !
63
64 # check more than one component, which enables -component
65 echo 'AliasFile: aliases' >>"$MMHP"
66 runandcheck 'mhparam path AliasFile' <<!
67 path: $MH_TEST_DIR/Mail
68 AliasFile: aliases
69 !
70
71
72 #### This exits with non-zero status, so let runandcheck squash that:
73 runandcheck 'mhparam formatproc rmmproc' <<!
74 !
75
76
77 # check -component
78 runandcheck 'mhparam -component Path' <<!
79 Path: $MH_TEST_DIR/Mail
80 !
81
82 # check -component, note that component name of argument is echoed exactly
83 runandcheck 'mhparam -component path' <<!
84 path: $MH_TEST_DIR/Mail
85 !
86 runandcheck 'mhparam -component PATH' <<!
87 PATH: $MH_TEST_DIR/Mail
88 !
89
90 # check -nocomponent
91 runandcheck 'mhparam -component -nocomponent path' <<!
92 $MH_TEST_DIR/Mail
93 !
94 runandcheck 'mhparam -nocomponent path AliasFile' <<!
95 $MH_TEST_DIR/Mail
96 aliases
97 !
98
99
100 # check nonexistent component
101 runandcheck 'mhparam nonexistent' <<!
102 !
103
104
105 # check that return status counts nonexistent components
106 runandcheck "mhparam path context nonexistent1 nonexistent2 \
107                 nonexistent3 >/dev/null; echo \$?" <<!
108 3
109 !
110 # check that return status counts nonexistent components
111 runandcheck "mhparam path context nonexistent1 nonexistent2 \
112                 nonexistent3 inbox >/dev/null; echo \$?" <<!
113 3
114 !
115
116 # mhparam -debug
117 # Some of its output depends on configure options, so don't bother to
118 # check for correctness here.
119 runandcheck "mhparam -debug >/dev/null; echo \$?" <<!
120 0
121 !
122
123 # check with text file that does not end with newline
124 printf 'Editor: emacs' >>"$MMHP"
125 runandcheck 'mhparam -nocomponent editor' <<!
126 emacs
127 !
128
129
130 exit
131
132 # FIXME: needs to be adjusted or removed ...
133
134 # check each component in procs array in uip/mhparam.c
135 # The tests don't override these, so they're default or configured values.
136 # Note that cat is hardcoded here because the testsuite uses it for moreproc.
137
138 runandcheck "mhparam -nocomponent \
139                 context \
140                 mh-sequences \
141                 buildmimeproc \
142                 fileproc \
143                 foldprot \
144                 incproc \
145                 lproc \
146                 mailproc \
147                 mhlproc \
148                 moreproc \
149                 msgprot \
150                 packproc \
151                 postproc \
152                 sendproc \
153                 showmimeproc \
154                 showproc \
155                 version \
156                 whatnowproc \
157                 whomproc \
158                 etcdir \
159                 libexecdir \
160                 datalocking \
161                 spoollocking" <<!
162 context
163 .mh_sequences
164 $MH_INST_DIR$bindir/mhbuild
165 $MH_INST_DIR$bindir/refile
166 700
167 $bindir/inc
168 more
169 $MH_INST_DIR$bindir/mhmail
170 $MH_INST_DIR$nmhlibexecdir/mhl
171 cat
172 600
173 $bindir/packf
174 $MH_INST_DIR$nmhlibexecdir/post
175 $MH_INST_DIR$bindir/send
176 $MH_INST_DIR$bindir/mhshow
177 $MH_INST_DIR$nmhlibexecdir/mhl
178 nmh-`cat ${srcdir}/VERSION`
179 $MH_INST_DIR$bindir/whatnow
180 $MH_INST_DIR$bindir/whom
181 $nmhetcdirinst
182 $MH_LIBEXEC_DIR
183 fcntl
184 ${default_locking}
185 !
186