]> diplodocus.org Git - nmh/blob - test/sequences/test-flist
mh-mkstemp.man: Detail exit status as 255 rather than -1.
[nmh] / test / sequences / test-flist
1 #!/bin/sh
2 ######################################################
3 #
4 # Test flist
5 #
6 ######################################################
7
8 set -e
9
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir=`dirname $0`/../..
12 MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
13 fi
14
15 . "$MH_OBJ_DIR/test/common.sh"
16
17 setup_test
18
19 check_exit '-eq 1' flist - # gcov
20
21 run_test 'mark 1 3 5 7 9 +inbox -sequence odd' ''
22 run_test 'mark -s odd -list' 'odd: 1 3 5 7 9'
23 run_test 'mark +inbox -sequence unseen all' ''
24 run_test 'mark +inbox -sequence unseen -list' 'unseen: 1-10'
25
26 folder -create +other > /dev/null
27 for i in 2 5 7 12; do
28 cp -p "$MH_TEST_DIR/Mail/inbox/1" "$MH_TEST_DIR/Mail/other/$i"
29 done
30 run_test 'mark +other -sequence unseen all' ''
31 run_test 'mark +other -sequence unseen -list' 'unseen: 2 5 7 12'
32
33 # Make sure that inbox is current folder.
34 folder -f +inbox > /dev/null
35
36 # Test flists.
37 run_test 'flists -seq odd' 'inbox+ has 5 in sequence odd; out of 10
38 other has 0 in sequence odd; out of 4'
39
40 run_test 'flists -seq unseen' \
41 'inbox+ has 10 in sequence unseen; out of 10
42 other has 4 in sequence unseen; out of 4'
43
44 # Test flist on individual folders, starting with the current folder.
45 run_test 'flist -sequence unseen' \
46 'inbox+ has 10 in sequence unseen; out of 10'
47 run_test 'flist +other -sequence unseen' \
48 'other+ has 4 in sequence unseen; out of 4'
49
50 # Test multiple folders and sequences.
51 run_test 'flist +inbox +other -seq unseen -seq odd' \
52 'inbox has 10 in sequence unseen; out of 10
53 inbox has 5 in sequence odd ; out of 10
54 other+ has 4 in sequence unseen; out of 4
55 other+ has 0 in sequence odd ; out of 4'
56
57 # Test Flist-Order with -noalpha.
58 echo 'Flist-Order: o* i*' >> "$MH"
59 run_test 'flists -seq unseen -seq odd -noalpha' \
60 'other+ has 4 in sequence unseen; out of 4
61 other+ has 0 in sequence odd ; out of 4
62 inbox has 10 in sequence unseen; out of 10
63 inbox has 5 in sequence odd ; out of 10'
64
65 # Test nonexistent folder.
66 run_test 'flist +nonexistent -seq unseen' ''
67
68 # Test nonexistent sequence.
69 run_test 'flist +inbox -seq nonexistent' \
70 'inbox+ has 0 in sequence nonexistent; out of 10'
71
72 # Test -fast.
73 folder -f +inbox > /dev/null
74 run_test 'flist -sequence unseen -fast' 'inbox'
75 run_test 'flist +other -sequence unseen -fast' 'other'
76
77 # Test -fast and -alpha.
78 run_test 'flists -seq unseen -fast -alpha' 'inbox
79 other'
80
81 exit $failed