]>
diplodocus.org Git - nmh/blob - test/new/test-basic
2 ######################################################
4 # Test many basic nmh capabilities.
6 ######################################################
8 if test -z "${MH_OBJ_DIR}"; then
9 srcdir
=`dirname "$0"`/..
/..
10 MH_OBJ_DIR
=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
13 .
"$MH_OBJ_DIR/test/common.sh"
17 check_exit
'-eq 1' folder
- # gcov
19 folders
=$MH_TEST_DIR/Mail
/.folders
21 expected
=$MH_TEST_DIR/$$.expected
22 actual
=$MH_TEST_DIR/$$.actual
25 cp -r $MH_TEST_DIR/Mail
/inbox
$MH_TEST_DIR/Mail
/foo1
26 cp -r $MH_TEST_DIR/Mail
/inbox
$MH_TEST_DIR/Mail
/foo2
27 # but only list inbox and foo2 in .folders, and sorted differently
33 # test with no sequence
34 start_test
'test with no sequence'
36 new: must specify sequences or set Unseen-Sequence
38 run_prog new
> $actual 2>&1 || true
39 check
$expected $actual
41 # test with no desired messages
42 start_test
'test with no desired messages'
46 run_prog new aseq
> $actual 2>&1
47 check
$expected $actual 'keep first'
48 run_prog new
-folders $folders aseq
> $actual 2>&1
49 check
$expected $actual
51 # test fnext/fprev with no desired messages
52 start_test
'test fnext/fprev with no desired messages'
53 cat /dev
/null
> $expected
54 run_prog fnext aseq
> $actual 2>&1
55 check
$expected $actual 'keep first'
56 run_prog fprev aseq
> $actual 2>&1
57 check
$expected $actual
59 # add 1 desired message in each folder
60 echo 'aseq: 1' > $MH_TEST_DIR/Mail
/inbox
/.mh_sequences
61 echo 'aseq: 1' > $MH_TEST_DIR/Mail
/foo
1/.mh_sequences
62 echo 'aseq: 1' > $MH_TEST_DIR/Mail
/foo
2/.mh_sequences
64 # test with all folders
65 start_test
'test with all folders'
72 run_prog new aseq
> $actual 2>&1
73 check
$expected $actual
76 start_test
'test with .folders'
82 run_prog new
-folders $folders aseq
> $actual 2>&1
83 check
$expected $actual
85 # add 2 desired messages to another sequence in each folder
86 echo 'bseq: 3-4' >> $MH_TEST_DIR/Mail
/inbox
/.mh_sequences
87 echo 'bseq: 3-4' >> $MH_TEST_DIR/Mail
/foo
1/.mh_sequences
88 echo 'bseq: 3-4' >> $MH_TEST_DIR/Mail
/foo
2/.mh_sequences
90 # test listing aseq and bseq
91 start_test
'test listing aseq and bseq'
98 run_prog new aseq bseq
> $actual 2>&1
99 check
$expected $actual 'keep first'
101 # set aseq bseq as unseen
102 echo 'Unseen-Sequence: aseq bseq' >> $MH
103 run_prog new
> $actual 2>&1
104 check
$expected $actual
107 start_test
'test unseen'
108 cat > $expected <<EOF
110 3 aseq bseq messages in foo1
111 1 09/29 Test1 Testing message 1<<This is message number 1 >>
112 3 09/29 Test3 Testing message 3<<This is message number 3 >>
113 4 09/29 Test4 Testing message 4<<This is message number 4 >>
115 3 aseq bseq messages in foo2
116 1 09/29 Test1 Testing message 1<<This is message number 1 >>
117 3 09/29 Test3 Testing message 3<<This is message number 3 >>
118 4 09/29 Test4 Testing message 4<<This is message number 4 >>
120 3 aseq bseq messages in inbox (*: current folder)
121 1 09/29 Test1 Testing message 1<<This is message number 1 >>
122 3 09/29 Test3 Testing message 3<<This is message number 3 >>
123 4 09/29 Test4 Testing message 4<<This is message number 4 >>
125 run_prog unseen
> $actual 2>&1
126 check
$expected $actual
128 # test fnext with the current folder not in the list
129 start_test
'test fnext with the current folder not in the list'
130 echo 'Current-Folder: foo1' > $MH_TEST_DIR/Mail
/context
131 echo 'inbox 1 3-4' > $expected
132 run_prog fnext
-folders $folders > $actual 2>&1
133 check
$expected $actual
135 # test fprev with the current folder not in the list
136 start_test
'test fprev with the current folder not in the list'
137 echo 'Current-Folder: foo1' > $MH_TEST_DIR/Mail
/context
138 echo 'inbox 1 3-4' > $expected
139 run_prog fprev
-folders $folders > $actual 2>&1
140 check
$expected $actual
142 # test fnext with current folder in the middle of the list
143 start_test
'test fnext with current folder in the middle of the list'
144 echo 'Current-Folder: foo2' > $MH_TEST_DIR/Mail
/context
145 echo 'inbox 1 3-4' > $expected
146 run_prog fnext
> $actual 2>&1
147 check
$expected $actual
149 # test fprev with current folder in the middle of the list
150 start_test
'test fprev with current folder in the middle of the list'
151 echo 'Current-Folder: foo2' > $MH_TEST_DIR/Mail
/context
152 echo 'foo1 1 3-4' > $expected
153 run_prog fprev
> $actual 2>&1
154 check
$expected $actual
156 # test fprev with current folder at the beginning of the list
157 start_test
'test fprev with current folder at the beginning of the list'
158 echo 'Current-Folder: foo1' > $MH_TEST_DIR/Mail
/context
159 echo 'inbox 1 3-4' > $expected
160 run_prog fprev
> $actual 2>&1
161 check
$expected $actual
163 # test fnext with current folder at the end of the list
164 start_test
'test fnext with current folder at the end of the list'
165 echo 'Current-Folder: inbox' > $MH_TEST_DIR/Mail
/context
166 echo 'foo1 1 3-4' > $expected
167 run_prog fnext
> $actual 2>&1
168 check
$expected $actual
170 # test fnext with no current folder
171 start_test
'test fnext with no current folder'
172 rm $MH_TEST_DIR/Mail
/context
173 echo 'foo1 1 3-4' > $expected
174 run_prog fnext
> $actual 2>&1
175 check
$expected $actual
177 # test fnext with only one folder in the list
178 start_test
'test fnext with only one folder in the list'
182 echo 'inbox 1 3-4' > $expected
183 run_prog fnext
-folders $folders > $actual 2>&1
184 check
$expected $actual