]>
diplodocus.org Git - nmh/blob - test/mhpath/test-mhpath
2 ######################################################
6 ######################################################
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir
=`dirname $0`/..
/..
12 MH_OBJ_DIR
=`cd $srcdir && pwd`; export MH_OBJ_DIR
15 .
"$MH_OBJ_DIR/test/common.sh"
19 expected
=$MH_TEST_DIR/$$.expected
20 actual
=$MH_TEST_DIR/$$.actual
25 Usage: mhpath [+folder] [msgs] [switches]
30 # The exit status is 1 with -help, so temporarily disable -e.
32 mhpath
-help > $actual 2>&1
34 check
$expected $actual
36 # check -version, which returns non-zero exit status
40 * ) echo "$0: mhpath -v generated unexpected output" 1>&2
41 failed
=`expr ${failed:-0} + 1`;;
46 run_test
"mhpath +" "$MH_TEST_DIR/Mail"
48 # check with no options
49 folder
-fast +inbox
> /dev
/null
50 run_test
"mhpath" "$MH_TEST_DIR/Mail/inbox"
53 run_test
"mhpath +inbox" "$MH_TEST_DIR/Mail/inbox"
57 $MH_TEST_DIR/Mail/inbox/1
58 $MH_TEST_DIR/Mail/inbox/2
59 $MH_TEST_DIR/Mail/inbox/3
60 $MH_TEST_DIR/Mail/inbox/4
61 $MH_TEST_DIR/Mail/inbox/5
62 $MH_TEST_DIR/Mail/inbox/6
63 $MH_TEST_DIR/Mail/inbox/7
64 $MH_TEST_DIR/Mail/inbox/8
65 $MH_TEST_DIR/Mail/inbox/9
66 $MH_TEST_DIR/Mail/inbox/10
68 mhpath all
> $actual 2>&1
69 check
$expected $actual
71 # check message number greater than highest
72 run_test
"mhpath 11" "mhpath: message 11 out of range 1-10"
73 run_test
"mhpath 10 11" "mhpath: message 11 out of range 1-10"
75 # check range with message number greater than highest
77 $MH_TEST_DIR/Mail/inbox/1
78 $MH_TEST_DIR/Mail/inbox/2
79 $MH_TEST_DIR/Mail/inbox/3
80 $MH_TEST_DIR/Mail/inbox/4
81 $MH_TEST_DIR/Mail/inbox/5
82 $MH_TEST_DIR/Mail/inbox/6
83 $MH_TEST_DIR/Mail/inbox/7
84 $MH_TEST_DIR/Mail/inbox/8
85 $MH_TEST_DIR/Mail/inbox/9
86 $MH_TEST_DIR/Mail/inbox/10
88 mhpath
1-99999 > $actual 2>&1
89 check
$expected $actual
92 run_test
"mhpath new" "$MH_TEST_DIR/Mail/inbox/11"
94 # check multiple msgs, including new
96 $MH_TEST_DIR/Mail/inbox/1
97 $MH_TEST_DIR/Mail/inbox/10
98 $MH_TEST_DIR/Mail/inbox/11
100 mhpath first last new
> $actual 2>&1
101 check
$expected $actual
103 # check invalid message list using names
104 run_test
"mhpath last-new" "mhpath: bad message list last-new"
107 folder
+inbox
5 > /dev
/null
108 run_test
"mhpath cur" "$MH_TEST_DIR/Mail/inbox/5"
111 run_test
"mhpath prev" "$MH_TEST_DIR/Mail/inbox/4"
114 run_test
"mhpath next" "$MH_TEST_DIR/Mail/inbox/6"
116 # check invalid message list using numbers
118 run_test
"mhpath 1-2" "mhpath: no messages in range 1-2"
120 # check ignoring of out-of-range message numbers in ranges
121 run_test
"mhpath 1-3" "$MH_TEST_DIR/Mail/inbox/3"
122 run_test
"mhpath first-3" "$MH_TEST_DIR/Mail/inbox/3"
123 run_test
"mhpath 10-11" "$MH_TEST_DIR/Mail/inbox/10"
124 run_test
"mhpath last-11" "$MH_TEST_DIR/Mail/inbox/10"
126 # check reference to existing messages
127 cat > $expected <<EOF
128 $MH_TEST_DIR/Mail/inbox/3
129 $MH_TEST_DIR/Mail/inbox/4
131 mhpath first
:2 > $actual 2>&1
132 check
$expected $actual
134 # check reference to non-existant messages
135 cat > $expected <<EOF
136 $MH_TEST_DIR/Mail/inbox/1
137 $MH_TEST_DIR/Mail/inbox/2
139 mhpath
1 2 > $actual 2>&1
140 check
$expected $actual