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
27 Usage: mhpath [+folder] [msgs] [switches]
33 #### Skip nmh intro text.
34 run_prog mhpath
-help | sed '/^$/,$d' >"$actual" 2>&1
35 check
"$expected" "$actual"
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 run_prog 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 run_prog 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 run_prog 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 run_prog mhpath first
:2 > $actual 2>&1
131 check
$expected $actual
133 # check reference to non-existent messages
134 cat > $expected <<EOF
135 $MH_TEST_DIR/Mail/inbox/1
136 $MH_TEST_DIR/Mail/inbox/2
138 run_prog mhpath
1 2 > $actual 2>&1
139 check
$expected $actual