]>
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 folders
=$MH_TEST_DIR/Mail
/.folders
19 expected
=$MH_TEST_DIR/$$.expected
20 actual
=$MH_TEST_DIR/$$.actual
23 cp -r $MH_TEST_DIR/Mail
/inbox
$MH_TEST_DIR/Mail
/foo1
24 cp -r $MH_TEST_DIR/Mail
/inbox
$MH_TEST_DIR/Mail
/foo2
25 # but only list inbox and foo2 in .folders, and sorted differently
31 # test with no sequence
32 start_test
'test with no sequence'
34 new: must specify sequences or set Unseen-Sequence
36 run_prog new
> $actual 2>&1 || true
37 check
$expected $actual
39 # test with no desired messages
40 start_test
'test with no desired messages'
44 run_prog new aseq
> $actual 2>&1
45 check
$expected $actual 'keep first'
46 run_prog new
-folders $folders aseq
> $actual 2>&1
47 check
$expected $actual
49 # test fnext/fprev with no desired messages
50 start_test
'test fnext/fprev with no desired messages'
51 cat /dev
/null
> $expected
52 run_prog fnext aseq
> $actual 2>&1
53 check
$expected $actual 'keep first'
54 run_prog fprev aseq
> $actual 2>&1
55 check
$expected $actual
57 # add 1 desired message in each folder
58 echo 'aseq: 1' > $MH_TEST_DIR/Mail
/inbox
/.mh_sequences
59 echo 'aseq: 1' > $MH_TEST_DIR/Mail
/foo
1/.mh_sequences
60 echo 'aseq: 1' > $MH_TEST_DIR/Mail
/foo
2/.mh_sequences
62 # test with all folders
63 start_test
'test with all folders'
70 run_prog new aseq
> $actual 2>&1
71 check
$expected $actual
74 start_test
'test with .folders'
80 run_prog new
-folders $folders aseq
> $actual 2>&1
81 check
$expected $actual
83 # add 2 desired messages to another sequence in each folder
84 echo 'bseq: 3-4' >> $MH_TEST_DIR/Mail
/inbox
/.mh_sequences
85 echo 'bseq: 3-4' >> $MH_TEST_DIR/Mail
/foo
1/.mh_sequences
86 echo 'bseq: 3-4' >> $MH_TEST_DIR/Mail
/foo
2/.mh_sequences
88 # test listing aseq and bseq
89 start_test
'test listing aseq and bseq'
96 run_prog new aseq bseq
> $actual 2>&1
97 check
$expected $actual 'keep first'
99 # set aseq bseq as unseen
100 echo 'Unseen-Sequence: aseq bseq' >> $MH
101 run_prog new
> $actual 2>&1
102 check
$expected $actual
105 start_test
'test unseen'
106 cat > $expected <<EOF
108 3 aseq bseq messages in foo1
109 1 09/29 Test1 Testing message 1<<This is message number 1 >>
110 3 09/29 Test3 Testing message 3<<This is message number 3 >>
111 4 09/29 Test4 Testing message 4<<This is message number 4 >>
113 3 aseq bseq messages in foo2
114 1 09/29 Test1 Testing message 1<<This is message number 1 >>
115 3 09/29 Test3 Testing message 3<<This is message number 3 >>
116 4 09/29 Test4 Testing message 4<<This is message number 4 >>
118 3 aseq bseq messages in inbox (*: current folder)
119 1 09/29 Test1 Testing message 1<<This is message number 1 >>
120 3 09/29 Test3 Testing message 3<<This is message number 3 >>
121 4 09/29 Test4 Testing message 4<<This is message number 4 >>
123 run_prog unseen
> $actual 2>&1
124 check
$expected $actual
126 # test fnext with the current folder not in the list
127 start_test
'test fnext with the current folder not in the list'
128 echo 'Current-Folder: foo1' > $MH_TEST_DIR/Mail
/context
129 echo 'inbox 1 3-4' > $expected
130 run_prog fnext
-folders $folders > $actual 2>&1
131 check
$expected $actual
133 # test fprev with the current folder not in the list
134 start_test
'test fprev with the current folder not in the list'
135 echo 'Current-Folder: foo1' > $MH_TEST_DIR/Mail
/context
136 echo 'inbox 1 3-4' > $expected
137 run_prog fprev
-folders $folders > $actual 2>&1
138 check
$expected $actual
140 # test fnext with current folder in the middle of the list
141 start_test
'test fnext with current folder in the middle of the list'
142 echo 'Current-Folder: foo2' > $MH_TEST_DIR/Mail
/context
143 echo 'inbox 1 3-4' > $expected
144 run_prog fnext
> $actual 2>&1
145 check
$expected $actual
147 # test fprev with current folder in the middle of the list
148 start_test
'test fprev with current folder in the middle of the list'
149 echo 'Current-Folder: foo2' > $MH_TEST_DIR/Mail
/context
150 echo 'foo1 1 3-4' > $expected
151 run_prog fprev
> $actual 2>&1
152 check
$expected $actual
154 # test fprev with current folder at the beginning of the list
155 start_test
'test fprev with current folder at the beginning of the list'
156 echo 'Current-Folder: foo1' > $MH_TEST_DIR/Mail
/context
157 echo 'inbox 1 3-4' > $expected
158 run_prog fprev
> $actual 2>&1
159 check
$expected $actual
161 # test fnext with current folder at the end of the list
162 start_test
'test fnext with current folder at the end of the list'
163 echo 'Current-Folder: inbox' > $MH_TEST_DIR/Mail
/context
164 echo 'foo1 1 3-4' > $expected
165 run_prog fnext
> $actual 2>&1
166 check
$expected $actual
168 # test fnext with no current folder
169 start_test
'test fnext with no current folder'
170 rm $MH_TEST_DIR/Mail
/context
171 echo 'foo1 1 3-4' > $expected
172 run_prog fnext
> $actual 2>&1
173 check
$expected $actual
175 # test fnext with only one folder in the list
176 start_test
'test fnext with only one folder in the list'
180 echo 'inbox 1 3-4' > $expected
181 run_prog fnext
-folders $folders > $actual 2>&1
182 check
$expected $actual