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
37 if mhpath -v | grep '^mhpath --' > /dev/null; then
40 echo "$0: mhpath -v generated unexpected output" 1>&2
41 failed=`expr ${failed:-0} + 1`
45 run_test "mhpath +" "$MH_TEST_DIR/Mail"
47 # check with no options
48 folder -fast +inbox > /dev/null
49 run_test "mhpath" "$MH_TEST_DIR/Mail/inbox"
52 run_test "mhpath +inbox" "$MH_TEST_DIR/Mail/inbox"
56 $MH_TEST_DIR/Mail/inbox/1
57 $MH_TEST_DIR/Mail/inbox/2
58 $MH_TEST_DIR/Mail/inbox/3
59 $MH_TEST_DIR/Mail/inbox/4
60 $MH_TEST_DIR/Mail/inbox/5
61 $MH_TEST_DIR/Mail/inbox/6
62 $MH_TEST_DIR/Mail/inbox/7
63 $MH_TEST_DIR/Mail/inbox/8
64 $MH_TEST_DIR/Mail/inbox/9
65 $MH_TEST_DIR/Mail/inbox/10
67 mhpath all > $actual 2>&1
68 check $expected $actual
70 # check message number greater than highest
71 run_test "mhpath 11" "mhpath: message 11 out of range 1-10"
72 run_test "mhpath 10 11" "mhpath: message 11 out of range 1-10"
74 # check range with message number greater than highest
76 $MH_TEST_DIR/Mail/inbox/1
77 $MH_TEST_DIR/Mail/inbox/2
78 $MH_TEST_DIR/Mail/inbox/3
79 $MH_TEST_DIR/Mail/inbox/4
80 $MH_TEST_DIR/Mail/inbox/5
81 $MH_TEST_DIR/Mail/inbox/6
82 $MH_TEST_DIR/Mail/inbox/7
83 $MH_TEST_DIR/Mail/inbox/8
84 $MH_TEST_DIR/Mail/inbox/9
85 $MH_TEST_DIR/Mail/inbox/10
87 mhpath 1-99999 > $actual 2>&1
88 check $expected $actual
91 run_test "mhpath new" "$MH_TEST_DIR/Mail/inbox/11"
93 # check multiple msgs, including new
95 $MH_TEST_DIR/Mail/inbox/1
96 $MH_TEST_DIR/Mail/inbox/10
97 $MH_TEST_DIR/Mail/inbox/11
99 mhpath first last new > $actual 2>&1
100 check $expected $actual
102 # check invalid message list using names
103 run_test "mhpath last-new" "mhpath: bad message list last-new"
106 folder +inbox 5 > /dev/null
107 run_test "mhpath cur" "$MH_TEST_DIR/Mail/inbox/5"
110 run_test "mhpath prev" "$MH_TEST_DIR/Mail/inbox/4"
113 run_test "mhpath next" "$MH_TEST_DIR/Mail/inbox/6"
115 # check invalid message list using numbers
117 run_test "mhpath 1-2" "mhpath: no messages in range 1-2"
119 # check ignoring of out-of-range message numbers in ranges
120 run_test "mhpath 1-3" "$MH_TEST_DIR/Mail/inbox/3"
121 run_test "mhpath first-3" "$MH_TEST_DIR/Mail/inbox/3"
122 run_test "mhpath 10-11" "$MH_TEST_DIR/Mail/inbox/10"
123 run_test "mhpath last-11" "$MH_TEST_DIR/Mail/inbox/10"
125 # check reference to existing messages
126 cat > $expected <<EOF
127 $MH_TEST_DIR/Mail/inbox/3
128 $MH_TEST_DIR/Mail/inbox/4
130 mhpath first:2 > $actual 2>&1
131 check $expected $actual
133 # check reference to non-existant messages
134 cat > $expected <<EOF
135 $MH_TEST_DIR/Mail/inbox/1
136 $MH_TEST_DIR/Mail/inbox/2
138 mhpath 1 2 > $actual 2>&1
139 check $expected $actual