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]
31 mhpath -help > $actual 2>&1
32 check $expected $actual
37 * ) echo "$0: mhpath -v generated unexpected output" 1>&2
38 failed=`expr ${failed:-0} + 1`;;
42 run_test "mhpath +" "$MH_TEST_DIR/Mail"
44 # check with no options
45 folder -fast +inbox > /dev/null
46 run_test "mhpath" "$MH_TEST_DIR/Mail/inbox"
49 run_test "mhpath +inbox" "$MH_TEST_DIR/Mail/inbox"
53 $MH_TEST_DIR/Mail/inbox/1
54 $MH_TEST_DIR/Mail/inbox/2
55 $MH_TEST_DIR/Mail/inbox/3
56 $MH_TEST_DIR/Mail/inbox/4
57 $MH_TEST_DIR/Mail/inbox/5
58 $MH_TEST_DIR/Mail/inbox/6
59 $MH_TEST_DIR/Mail/inbox/7
60 $MH_TEST_DIR/Mail/inbox/8
61 $MH_TEST_DIR/Mail/inbox/9
62 $MH_TEST_DIR/Mail/inbox/10
64 mhpath all > $actual 2>&1
65 check $expected $actual
67 # check message number greater than highest
68 run_test "mhpath 11" "mhpath: message 11 out of range 1-10"
69 run_test "mhpath 10 11" "mhpath: message 11 out of range 1-10"
71 # check range with message number greater than highest
73 $MH_TEST_DIR/Mail/inbox/1
74 $MH_TEST_DIR/Mail/inbox/2
75 $MH_TEST_DIR/Mail/inbox/3
76 $MH_TEST_DIR/Mail/inbox/4
77 $MH_TEST_DIR/Mail/inbox/5
78 $MH_TEST_DIR/Mail/inbox/6
79 $MH_TEST_DIR/Mail/inbox/7
80 $MH_TEST_DIR/Mail/inbox/8
81 $MH_TEST_DIR/Mail/inbox/9
82 $MH_TEST_DIR/Mail/inbox/10
84 mhpath 1-99999 > $actual 2>&1
85 check $expected $actual
88 run_test "mhpath new" "$MH_TEST_DIR/Mail/inbox/11"
90 # check multiple msgs, including new
92 $MH_TEST_DIR/Mail/inbox/1
93 $MH_TEST_DIR/Mail/inbox/10
94 $MH_TEST_DIR/Mail/inbox/11
96 mhpath first last new > $actual 2>&1
97 check $expected $actual
99 # check invalid message list using names
100 run_test "mhpath last-new" "mhpath: bad message list last-new"
103 folder +inbox 5 > /dev/null
104 run_test "mhpath cur" "$MH_TEST_DIR/Mail/inbox/5"
107 run_test "mhpath prev" "$MH_TEST_DIR/Mail/inbox/4"
110 run_test "mhpath next" "$MH_TEST_DIR/Mail/inbox/6"
112 # check invalid message list using numbers
114 run_test "mhpath 1-2" "mhpath: no messages in range 1-2"
116 # check ignoring of out-of-range message numbers in ranges
117 run_test "mhpath 1-3" "$MH_TEST_DIR/Mail/inbox/3"
118 run_test "mhpath first-3" "$MH_TEST_DIR/Mail/inbox/3"
119 run_test "mhpath 10-11" "$MH_TEST_DIR/Mail/inbox/10"
120 run_test "mhpath last-11" "$MH_TEST_DIR/Mail/inbox/10"
122 # check reference to existing messages
123 cat > $expected <<EOF
124 $MH_TEST_DIR/Mail/inbox/3
125 $MH_TEST_DIR/Mail/inbox/4
127 mhpath first:2 > $actual 2>&1
128 check $expected $actual
130 # check reference to non-existant messages
131 cat > $expected <<EOF
132 $MH_TEST_DIR/Mail/inbox/1
133 $MH_TEST_DIR/Mail/inbox/2
135 mhpath 1 2 > $actual 2>&1
136 check $expected $actual