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
33 new: must specify sequences or set Unseen-Sequence
36 check $expected $actual
38 # test with no desired messages
42 new aseq > $actual 2>&1
43 check $expected $actual 'keep first'
44 new -folders $folders aseq > $actual 2>&1
45 check $expected $actual
47 # test fnext/fprev with no desired messages
48 cat /dev/null > $expected
49 fnext aseq > $actual 2>&1
50 check $expected $actual 'keep first'
51 fprev aseq > $actual 2>&1
52 check $expected $actual
54 # add 1 desired message in each folder
55 echo 'aseq: 1' > $MH_TEST_DIR/Mail/inbox/.mh_sequences
56 echo 'aseq: 1' > $MH_TEST_DIR/Mail/foo1/.mh_sequences
57 echo 'aseq: 1' > $MH_TEST_DIR/Mail/foo2/.mh_sequences
59 # test with all folders
66 new aseq > $actual 2>&1
67 check $expected $actual
75 new -folders $folders aseq > $actual 2>&1
76 check $expected $actual
78 # add 2 desired messages to another sequence in each folder
79 echo 'bseq: 3-4' >> $MH_TEST_DIR/Mail/inbox/.mh_sequences
80 echo 'bseq: 3-4' >> $MH_TEST_DIR/Mail/foo1/.mh_sequences
81 echo 'bseq: 3-4' >> $MH_TEST_DIR/Mail/foo2/.mh_sequences
83 # test listing aseq and bseq
90 new aseq bseq > $actual 2>&1
91 check $expected $actual 'keep first'
93 # set aseq bseq as unseen
94 echo 'Unseen-Sequence: aseq bseq' >> $MH
96 check $expected $actual
101 3 aseq bseq messages in foo1
102 1 09/29 Test1 Testing message 1<<This is message number 1 >>
103 3 09/29 Test3 Testing message 3<<This is message number 3 >>
104 4 09/29 Test4 Testing message 4<<This is message number 4 >>
106 3 aseq bseq messages in foo2
107 1 09/29 Test1 Testing message 1<<This is message number 1 >>
108 3 09/29 Test3 Testing message 3<<This is message number 3 >>
109 4 09/29 Test4 Testing message 4<<This is message number 4 >>
111 3 aseq bseq messages in inbox (*: current folder)
112 1 09/29 Test1 Testing message 1<<This is message number 1 >>
113 3 09/29 Test3 Testing message 3<<This is message number 3 >>
114 4 09/29 Test4 Testing message 4<<This is message number 4 >>
116 unseen > $actual 2>&1
117 check $expected $actual
119 # test fnext with the current folder not in the list
120 echo 'Current-Folder: foo1' > $MH_TEST_DIR/Mail/context
121 echo 'inbox 1 3-4' > $expected
122 fnext -folders $folders > $actual 2>&1
123 check $expected $actual
125 # test fprev with the current folder not in the list
126 echo 'Current-Folder: foo1' > $MH_TEST_DIR/Mail/context
127 echo 'inbox 1 3-4' > $expected
128 fprev -folders $folders > $actual 2>&1
129 check $expected $actual
131 # test fnext with current folder in the middle of the list
132 echo 'Current-Folder: foo2' > $MH_TEST_DIR/Mail/context
133 echo 'inbox 1 3-4' > $expected
135 check $expected $actual
137 # test fprev with current folder in the middle of the list
138 echo 'Current-Folder: foo2' > $MH_TEST_DIR/Mail/context
139 echo 'foo1 1 3-4' > $expected
141 check $expected $actual
143 # test fprev with current folder at the beginning of the list
144 echo 'Current-Folder: foo1' > $MH_TEST_DIR/Mail/context
145 echo 'inbox 1 3-4' > $expected
147 check $expected $actual
149 # test fnext with current folder at the end of the list
150 echo 'Current-Folder: inbox' > $MH_TEST_DIR/Mail/context
151 echo 'foo1 1 3-4' > $expected
153 check $expected $actual
155 # test fnext with no current folder
156 rm $MH_TEST_DIR/Mail/context
157 echo 'foo1 1 3-4' > $expected
159 check $expected $actual
161 # test fnext with only one folder in the list
165 echo 'inbox 1 3-4' > $expected
166 fnext -folders $folders > $actual 2>&1
167 check $expected $actual