File: test-flist

package info (click to toggle)
nmh 1.8-4
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 7,860 kB
  • sloc: ansic: 50,445; sh: 22,697; makefile: 1,138; lex: 740; perl: 509; yacc: 265
file content (91 lines) | stat: -rwxr-xr-x 2,723 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/sh
######################################################
#
# Test flist
#
######################################################

set -e

if test -z "${MH_OBJ_DIR}"; then
    srcdir=`dirname $0`/../..
    MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
fi

. "$MH_OBJ_DIR/test/common.sh"

setup_test

check_exit '-eq 1' flist -
check_exit '-eq 1' flist -xyzzy
check_exit '-eq 0' flist -help
check_exit '-eq 0' flist -version
check_exit '-eq 1' flist -sequence
check_exit '-eq 1' flist -all -noall -showzero -noshowzero \
    -recurse -norecurse -total -
x=tendixzehn
l=$x$x$x$x$x
c=$l$l
check_exit '-eq 1' flist `echo $c | sed 's/./& /g'` 101 -

run_test 'mark 1 3 5 7 9 +inbox -sequence odd' ''
run_test 'mark -s odd -list' 'odd: 1 3 5 7 9'
run_test 'mark +inbox -sequence unseen all' ''
run_test 'mark +inbox -sequence unseen -list' 'unseen: 1-10'

folder -create +other > /dev/null
for i in 2 5 7 12; do
  cp -p "$MH_TEST_DIR/Mail/inbox/1" "$MH_TEST_DIR/Mail/other/$i"
done
run_test 'mark +other -sequence unseen all' ''
run_test 'mark +other -sequence unseen -list' 'unseen: 2 5 7 12'

# Make sure that inbox is current folder.
folder -f +inbox > /dev/null

# Test flists.
run_test 'flists -seq odd' 'inbox+ has 5 in sequence odd; out of 10
other  has 0 in sequence odd; out of  4'

run_test 'flists -seq unseen' \
         'inbox+ has 10 in sequence unseen; out of 10
other  has  4 in sequence unseen; out of  4'

# Test flist on individual folders, starting with the current folder.
run_test 'flist -sequence unseen' \
         'inbox+ has 10 in sequence unseen; out of 10'
run_test 'flist +other -sequence unseen' \
         'other+ has 4 in sequence unseen; out of 4'

# Test multiple folders and sequences.
run_test 'flist +inbox +other -seq unseen -seq odd' \
         'inbox  has 10 in sequence unseen; out of 10
inbox  has  5 in sequence odd   ; out of 10
other+ has  4 in sequence unseen; out of  4
other+ has  0 in sequence odd   ; out of  4'

# Test Flist-Order with -noalpha.
echo 'Flist-Order: o* i*' >> "$MH"
run_test 'flists -seq unseen -seq odd -noalpha' \
         'other+ has  4 in sequence unseen; out of  4
other+ has  0 in sequence odd   ; out of  4
inbox  has 10 in sequence unseen; out of 10
inbox  has  5 in sequence odd   ; out of 10'

# Test nonexistent folder.
run_test 'flist +nonexistent -seq unseen' ''

# Test nonexistent sequence.
run_test 'flist +inbox -seq nonexistent' \
         'inbox+ has 0 in sequence nonexistent; out of 10'

# Test -fast.
folder -f +inbox > /dev/null
run_test 'flist -sequence unseen -fast' 'inbox'
run_test 'flist +other -sequence unseen -fast' 'other'

# Test -fast and -alpha.
run_test 'flists -seq unseen -fast -alpha' 'inbox
other'

exit $failed