Changed msg_style and msg_delim to be file static to m_getfld.c
[mmh] / 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 run_test 'mark 1 3 5 7 9 +inbox -sequence odd' ''
20 run_test 'mark -s odd -list' 'odd: 1 3 5 7 9'
21 run_test 'mark +inbox -sequence unseen all' ''
22 run_test 'mark +inbox -sequence unseen -list' 'unseen: 1-10'
23
24 folder -create +other > /dev/null
25 for i in 2 5 7 12; do
26   cp -p "$MH_TEST_DIR/Mail/inbox/1" "$MH_TEST_DIR/Mail/other/$i"
27 done
28 run_test 'mark +other -sequence unseen all' ''
29 run_test 'mark +other -sequence unseen -list' 'unseen: 2 5 7 12'
30
31 # Make sure that inbox is current folder.
32 folder -f +inbox > /dev/null
33
34 # Test flists.
35 run_test 'flists -seq odd' 'inbox+ has 5 in sequence odd; out of 10
36 other  has 0 in sequence odd; out of  4'
37
38 run_test 'flists -seq unseen' \
39          'inbox+ has 10 in sequence unseen; out of 10
40 other  has  4 in sequence unseen; out of  4'
41
42 # Test flist on individual folders, starting with the current folder.
43 run_test 'flist -sequence unseen' \
44          'inbox+ has 10 in sequence unseen; out of 10'
45 run_test 'flist +other -sequence unseen' \
46          'other+ has 4 in sequence unseen; out of 4'
47
48 # Test multiple folders and sequences.
49 run_test 'flist +inbox +other -seq unseen -seq odd' \
50          'inbox  has 10 in sequence unseen; out of 10
51 inbox  has  5 in sequence odd   ; out of 10
52 other+ has  4 in sequence unseen; out of  4
53 other+ has  0 in sequence odd   ; out of  4'
54
55 # Test Flist-Order with -noalpha.
56 echo 'Flist-Order: o* i*' >> $MH_TEST_DIR/Mail/.mh_profile
57 run_test 'flists -seq unseen -seq odd -noalpha' \
58          'other+ has  4 in sequence unseen; out of  4
59 other+ has  0 in sequence odd   ; out of  4
60 inbox  has 10 in sequence unseen; out of 10
61 inbox  has  5 in sequence odd   ; out of 10'
62
63 # Test nonexistent folder.
64 run_test 'flist +nonexistent -seq unseen' ''
65
66 # Test nonexistent sequence.
67 run_test 'flist +inbox -seq nonexistent' \
68          'inbox+ has 0 in sequence nonexistent; out of 10'
69
70 # Test -fast.
71 folder -f +inbox > /dev/null
72 run_test 'flist -sequence unseen -fast' 'inbox'
73 run_test 'flist +other -sequence unseen -fast' 'other'
74
75 # Test -fast and -alpha.
76 run_test 'flists -seq unseen -fast -alpha' 'inbox
77 other'
78
79 exit $failed