]> diplodocus.org Git - nmh/blob - test/sequences/test-flist
sbr/mf.c: Simplify logic, ditching endless for-loops and switch.
[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 -
20 check_exit '-eq 1' flist -xyzzy
21 check_exit '-eq 0' flist -help
22 check_exit '-eq 0' flist -version
23 check_exit '-eq 1' flist -sequence
24 check_exit '-eq 1' flist -all -noall -showzero -noshowzero \
25 -recurse -norecurse -total -
26 x=tendixzehn
27 l=$x$x$x$x$x
28 c=$l$l
29 check_exit '-eq 1' flist `echo $c | sed 's/./& /g'` 101 -
30
31 run_test 'mark 1 3 5 7 9 +inbox -sequence odd' ''
32 run_test 'mark -s odd -list' 'odd: 1 3 5 7 9'
33 run_test 'mark +inbox -sequence unseen all' ''
34 run_test 'mark +inbox -sequence unseen -list' 'unseen: 1-10'
35
36 folder -create +other > /dev/null
37 for i in 2 5 7 12; do
38 cp -p "$MH_TEST_DIR/Mail/inbox/1" "$MH_TEST_DIR/Mail/other/$i"
39 done
40 run_test 'mark +other -sequence unseen all' ''
41 run_test 'mark +other -sequence unseen -list' 'unseen: 2 5 7 12'
42
43 # Make sure that inbox is current folder.
44 folder -f +inbox > /dev/null
45
46 # Test flists.
47 run_test 'flists -seq odd' 'inbox+ has 5 in sequence odd; out of 10
48 other has 0 in sequence odd; out of 4'
49
50 run_test 'flists -seq unseen' \
51 'inbox+ has 10 in sequence unseen; out of 10
52 other has 4 in sequence unseen; out of 4'
53
54 # Test flist on individual folders, starting with the current folder.
55 run_test 'flist -sequence unseen' \
56 'inbox+ has 10 in sequence unseen; out of 10'
57 run_test 'flist +other -sequence unseen' \
58 'other+ has 4 in sequence unseen; out of 4'
59
60 # Test multiple folders and sequences.
61 run_test 'flist +inbox +other -seq unseen -seq odd' \
62 'inbox has 10 in sequence unseen; out of 10
63 inbox has 5 in sequence odd ; out of 10
64 other+ has 4 in sequence unseen; out of 4
65 other+ has 0 in sequence odd ; out of 4'
66
67 # Test Flist-Order with -noalpha.
68 echo 'Flist-Order: o* i*' >> "$MH"
69 run_test 'flists -seq unseen -seq odd -noalpha' \
70 'other+ has 4 in sequence unseen; out of 4
71 other+ has 0 in sequence odd ; out of 4
72 inbox has 10 in sequence unseen; out of 10
73 inbox has 5 in sequence odd ; out of 10'
74
75 # Test nonexistent folder.
76 run_test 'flist +nonexistent -seq unseen' ''
77
78 # Test nonexistent sequence.
79 run_test 'flist +inbox -seq nonexistent' \
80 'inbox+ has 0 in sequence nonexistent; out of 10'
81
82 # Test -fast.
83 folder -f +inbox > /dev/null
84 run_test 'flist -sequence unseen -fast' 'inbox'
85 run_test 'flist +other -sequence unseen -fast' 'other'
86
87 # Test -fast and -alpha.
88 run_test 'flists -seq unseen -fast -alpha' 'inbox
89 other'
90
91 exit $failed