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 check_exit
'-eq 1' mhpath
-
21 expected
=$MH_TEST_DIR/$$.expected
22 actual
=$MH_TEST_DIR/$$.actual
28 Usage: mhpath [+folder] [msgs] [switches]
34 #### Skip nmh intro text.
35 run_prog mhpath
-help 2>&1 | sed '/^$/,$d' >"$actual"
36 check
"$expected" "$actual"
42 * ) echo "$0: mhpath -v generated unexpected output" 1>&2
43 failed
=`expr ${failed:-0} + 1`;;
48 run_test
"mhpath +" "$MH_TEST_DIR/Mail"
50 # check with no options
51 start_test
"with no options"
52 folder
-fast +inbox
> /dev
/null
53 run_test
"mhpath" "$MH_TEST_DIR/Mail/inbox"
57 run_test
"mhpath +inbox" "$MH_TEST_DIR/Mail/inbox"
62 $MH_TEST_DIR/Mail/inbox/1
63 $MH_TEST_DIR/Mail/inbox/2
64 $MH_TEST_DIR/Mail/inbox/3
65 $MH_TEST_DIR/Mail/inbox/4
66 $MH_TEST_DIR/Mail/inbox/5
67 $MH_TEST_DIR/Mail/inbox/6
68 $MH_TEST_DIR/Mail/inbox/7
69 $MH_TEST_DIR/Mail/inbox/8
70 $MH_TEST_DIR/Mail/inbox/9
71 $MH_TEST_DIR/Mail/inbox/10
73 run_prog mhpath all
> $actual 2>&1
74 check
$expected $actual
76 # check message number greater than highest
77 start_test
"message number greater than highest"
78 run_test
"mhpath 11" "mhpath: message 11 out of range 1-10"
79 run_test
"mhpath 10 11" "mhpath: message 11 out of range 1-10"
81 # check range with message number greater than highest
82 start_test
"range with message number greater than highest"
84 $MH_TEST_DIR/Mail/inbox/1
85 $MH_TEST_DIR/Mail/inbox/2
86 $MH_TEST_DIR/Mail/inbox/3
87 $MH_TEST_DIR/Mail/inbox/4
88 $MH_TEST_DIR/Mail/inbox/5
89 $MH_TEST_DIR/Mail/inbox/6
90 $MH_TEST_DIR/Mail/inbox/7
91 $MH_TEST_DIR/Mail/inbox/8
92 $MH_TEST_DIR/Mail/inbox/9
93 $MH_TEST_DIR/Mail/inbox/10
95 run_prog mhpath
1-99999 > $actual 2>&1
96 check
$expected $actual
100 run_test
"mhpath new" "$MH_TEST_DIR/Mail/inbox/11"
102 # check multiple msgs, including new
103 start_test
"multiple msgs, including new"
104 cat > $expected <<EOF
105 $MH_TEST_DIR/Mail/inbox/1
106 $MH_TEST_DIR/Mail/inbox/10
107 $MH_TEST_DIR/Mail/inbox/11
109 run_prog mhpath first last new
> $actual 2>&1
110 check
$expected $actual
112 # check invalid message list using names
113 start_test
"invalid message list using names"
114 run_test
"mhpath last-new" "mhpath: bad message list last-new"
118 folder
+inbox
5 > /dev
/null
119 run_test
"mhpath cur" "$MH_TEST_DIR/Mail/inbox/5"
123 run_test
"mhpath prev" "$MH_TEST_DIR/Mail/inbox/4"
127 run_test
"mhpath next" "$MH_TEST_DIR/Mail/inbox/6"
129 # check invalid message list using numbers
130 start_test
"invalid message list using numbers"
132 run_test
"mhpath 1-2" "mhpath: no messages in range 1-2"
134 # check ignoring of out-of-range message numbers in ranges
135 start_test
"ignoring of out-of-range message numbers in ranges"
136 run_test
"mhpath 1-3" "$MH_TEST_DIR/Mail/inbox/3"
137 run_test
"mhpath first-3" "$MH_TEST_DIR/Mail/inbox/3"
138 run_test
"mhpath 10-11" "$MH_TEST_DIR/Mail/inbox/10"
139 run_test
"mhpath last-11" "$MH_TEST_DIR/Mail/inbox/10"
141 # check reference to existing messages
142 start_test
"reference to existing messages"
143 cat > $expected <<EOF
144 $MH_TEST_DIR/Mail/inbox/3
145 $MH_TEST_DIR/Mail/inbox/4
147 run_prog mhpath first
:2 > $actual 2>&1
148 check
$expected $actual
150 # check reference to non-existent messages
151 start_test
"reference to non-existent messages"
152 cat > $expected <<EOF
153 $MH_TEST_DIR/Mail/inbox/1
154 $MH_TEST_DIR/Mail/inbox/2
156 run_prog mhpath
1 2 > $actual 2>&1
157 check
$expected $actual