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]
32 mhpath -help > $actual 2>&1
33 check $expected $actual
38 * ) echo "$0: mhpath -v generated unexpected output" 1>&2
39 failed=`expr ${failed:-0} + 1`;;
43 run_test "mhpath +" "$MH_TEST_DIR/Mail"
45 # check with no options
46 folder -fast +inbox > /dev/null
47 run_test "mhpath" "$MH_TEST_DIR/Mail/inbox"
50 run_test "mhpath +inbox" "$MH_TEST_DIR/Mail/inbox"
54 $MH_TEST_DIR/Mail/inbox/1
55 $MH_TEST_DIR/Mail/inbox/2
56 $MH_TEST_DIR/Mail/inbox/3
57 $MH_TEST_DIR/Mail/inbox/4
58 $MH_TEST_DIR/Mail/inbox/5
59 $MH_TEST_DIR/Mail/inbox/6
60 $MH_TEST_DIR/Mail/inbox/7
61 $MH_TEST_DIR/Mail/inbox/8
62 $MH_TEST_DIR/Mail/inbox/9
63 $MH_TEST_DIR/Mail/inbox/10
65 mhpath all > $actual 2>&1
66 check $expected $actual
68 # check message number greater than highest
69 run_test "mhpath 11" "mhpath: message 11 out of range 1-10"
70 run_test "mhpath 10 11" "mhpath: message 11 out of range 1-10"
72 # check range with message number greater than highest
74 $MH_TEST_DIR/Mail/inbox/1
75 $MH_TEST_DIR/Mail/inbox/2
76 $MH_TEST_DIR/Mail/inbox/3
77 $MH_TEST_DIR/Mail/inbox/4
78 $MH_TEST_DIR/Mail/inbox/5
79 $MH_TEST_DIR/Mail/inbox/6
80 $MH_TEST_DIR/Mail/inbox/7
81 $MH_TEST_DIR/Mail/inbox/8
82 $MH_TEST_DIR/Mail/inbox/9
83 $MH_TEST_DIR/Mail/inbox/10
85 mhpath 1-99999 > $actual 2>&1
86 check $expected $actual
89 run_test "mhpath new" "$MH_TEST_DIR/Mail/inbox/11"
91 # check multiple msgs, including new
93 $MH_TEST_DIR/Mail/inbox/1
94 $MH_TEST_DIR/Mail/inbox/10
95 $MH_TEST_DIR/Mail/inbox/11
97 mhpath first last new > $actual 2>&1
98 check $expected $actual
100 # check invalid message list using names
101 run_test "mhpath last-new" "mhpath: bad message list last-new"
104 folder +inbox 5 > /dev/null
105 run_test "mhpath cur" "$MH_TEST_DIR/Mail/inbox/5"
108 run_test "mhpath prev" "$MH_TEST_DIR/Mail/inbox/4"
111 run_test "mhpath next" "$MH_TEST_DIR/Mail/inbox/6"
113 # check invalid message list using numbers
115 run_test "mhpath 1-2" "mhpath: no messages in range 1-2"
117 # check ignoring of out-of-range message numbers in ranges
118 run_test "mhpath 1-3" "$MH_TEST_DIR/Mail/inbox/3"
119 run_test "mhpath first-3" "$MH_TEST_DIR/Mail/inbox/3"
120 run_test "mhpath 10-11" "$MH_TEST_DIR/Mail/inbox/10"
121 run_test "mhpath last-11" "$MH_TEST_DIR/Mail/inbox/10"
123 # check reference to existing messages
124 cat > $expected <<EOF
125 $MH_TEST_DIR/Mail/inbox/3
126 $MH_TEST_DIR/Mail/inbox/4
128 mhpath first:2 > $actual 2>&1
129 check $expected $actual
131 # check reference to non-existant messages
132 cat > $expected <<EOF
133 $MH_TEST_DIR/Mail/inbox/1
134 $MH_TEST_DIR/Mail/inbox/2
136 mhpath 1 2 > $actual 2>&1
137 check $expected $actual