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"
24 cat >"$expected" <<EOF
25 Usage: packf [+folder] [msgs] [switches]
34 packf -help >"$actual" 2>&1
35 check "$expected" "$actual"
40 * ) printf '%s: packf -v generated unexpected output\n' "$0" >&2
41 failed=`expr ${failed:-0} + 1`;;
44 # check unknown switch
45 run_test "packf -nonexistent" 'packf: -nonexistent unknown'
47 cd "${MH_TEST_DIR}" || exit 1
48 printf 'y\n' >Mail/yes
50 # check with no switches
52 inc +inbox2 -file msgbox <Mail/yes >/dev/null
53 rm -f msgbox .msgbox.map
54 for i in `pick +inbox`; do
55 diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`"
57 run_test "printf $i" '10'
58 rmm +inbox2 -unlink `pick +inbox2`
61 packf +inbox <Mail/yes
62 inc +inbox2 -file msgbox >/dev/null
63 rm -f msgbox .msgbox.map
64 for i in `pick +inbox`; do
65 diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`"
67 run_test "printf $i" '10'
68 rmm +inbox2 -unlink `pick +inbox2`
71 packf +inbox 1 2 3 <Mail/yes
72 inc +inbox2 -file msgbox >/dev/null
73 rm -f msgbox .msgbox.map
74 for i in `pick +inbox2`; do
75 diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`"
77 run_test "printf $i" '3'
78 rmm +inbox2 -unlink `pick +inbox2`
81 packf +inbox -file msgbox2 <Mail/yes
82 inc +inbox2 -file msgbox2 >/dev/null
83 for i in `pick +inbox2`; do
84 diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`"
86 run_test "printf $i" '10'
87 rmm +inbox2 -unlink `pick +inbox2`
89 # check append to existing mbox file
90 packf +inbox -file msgbox2 <Mail/yes
91 inc +inbox2 -file msgbox2 >/dev/null
92 rm -f msgbox2 .msgbox2.map
93 for i in `pick +inbox2`; do
94 if [ $i -le 10 ]; then
95 diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`"
98 diff "`mhpath +inbox $arith_val`" "`mhpath +inbox2 $i`"
101 run_test "printf $i" '20'
102 rmm +inbox2 -unlink `pick +inbox2`
105 packf +inbox -mbox <Mail/yes
106 inc +inbox2 -file msgbox >/dev/null
107 rm -f msgbox .msgbox.map
108 for i in `pick +inbox2`; do
109 diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`"
111 run_test "printf $i" '10'
112 rmm +inbox2 -unlink `pick +inbox2`
115 packf +inbox -mmdf <Mail/yes
116 inc +inbox2 -file msgbox >/dev/null
117 rm -f msgbox .msgbox.map
118 for i in `pick +inbox2`; do
119 diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`"
121 run_test "printf $i" '10'
122 rmm +inbox2 -unlink `pick +inbox2`
124 # check append to existing mmdf file
125 packf +inbox -mmdf <Mail/yes
126 inc +inbox2 -file msgbox >/dev/null
127 rm -f msgbox .msgbox.map
128 for i in `pick +inbox2`; do
129 if [ $i -le 10 ]; then
130 diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`"
133 diff "`mhpath +inbox $arith_val`" "`mhpath +inbox2 $i`"
136 run_test "printf $i" '10'
137 rmm +inbox2 -unlink `pick +inbox2`