]> diplodocus.org Git - nmh/blobdiff - test/folder/test-packf
Added start_test/finish_test to a bunch of tests.
[nmh] / test / folder / test-packf
index 1e341bb10b6e8fe2386e65afc86e7e7f191654e2..9a2932fd7f0a77d47769d51c5914e5ee63729f69 100755 (executable)
@@ -16,13 +16,14 @@ fi
 
 setup_test
 
-packf - >/dev/null 2>&1 || true  # gcov
+check_exit '-eq 1' packf -
 
 expected="$MH_TEST_DIR/$$.expected"
 actual="$MH_TEST_DIR/$$.actual"
 
 
 # check -help
+start_test "-help"
 cat >"$expected" <<EOF
 Usage: packf [+folder] [msgs] [switches]
   switches are:
@@ -34,10 +35,11 @@ Usage: packf [+folder] [msgs] [switches]
 EOF
 
 #### Skip nmh intro text.
-packf -help | sed '/^$/,$d' >"$actual" 2>&1
+packf -help 2>&1 | sed '/^$/,$d' >"$actual"
 check "$expected" "$actual"
 
 # check -version
+start_test "-version"
 case `packf -v` in
   packf\ --*) ;;
   *         ) printf '%s: packf -v generated unexpected output\n' "$0" >&2
@@ -45,15 +47,17 @@ case `packf -v` in
 esac
 
 # check unknown switch
+start_test "unknown switch"
 run_test "packf -nonexistent" 'packf: -nonexistent unknown'
 
 cd "${MH_TEST_DIR}"  ||  exit 1
 printf 'y\n' >Mail/yes
 
 # check with no switches
+start_test "with no switches"
 run_prog packf <Mail/yes
 inc +inbox2 -file msgbox <Mail/yes >/dev/null
-rm -f msgbox .msgbox.map
+rm -f msgbox
 for i in `pick +inbox`; do
   diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`"
 done
@@ -61,9 +65,10 @@ run_test "printf $i" '10'
 rmm +inbox2 -unlink `pick +inbox2`
 
 # check +folder
+start_test "+folder"
 run_prog packf +inbox <Mail/yes
 inc +inbox2 -file msgbox >/dev/null
-rm -f msgbox .msgbox.map
+rm -f msgbox
 for i in `pick +inbox`; do
   diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`"
 done
@@ -71,9 +76,10 @@ run_test "printf $i" '10'
 rmm +inbox2 -unlink `pick +inbox2`
 
 # check msgs
+start_test "msgs"
 run_prog packf +inbox 1 2 3 <Mail/yes
 inc +inbox2 -file msgbox >/dev/null
-rm -f msgbox .msgbox.map
+rm -f msgbox
 for i in `pick +inbox2`; do
   diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`"
 done
@@ -81,6 +87,7 @@ run_test "printf $i" '3'
 rmm +inbox2 -unlink `pick +inbox2`
 
 # check -file
+start_test "-file"
 run_prog packf +inbox -file msgbox2 <Mail/yes
 inc +inbox2 -file msgbox2 >/dev/null
 for i in `pick +inbox2`; do
@@ -90,9 +97,10 @@ run_test "printf $i" '10'
 rmm +inbox2 -unlink `pick +inbox2`
 
 # check append to existing mbox file
+start_test "append to existing mbox file"
 run_prog packf +inbox -file msgbox2 <Mail/yes
 inc +inbox2 -file msgbox2 >/dev/null
-rm -f msgbox2 .msgbox2.map
+rm -f msgbox2
 for i in `pick +inbox2`; do
   if [ $i -le 10 ]; then
     diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`"
@@ -105,9 +113,10 @@ run_test "printf $i" '20'
 rmm +inbox2 -unlink `pick +inbox2`
 
 # check -mbox
+start_test "-mbox"
 run_prog packf +inbox -mbox <Mail/yes
 inc +inbox2 -file msgbox >/dev/null
-rm -f msgbox .msgbox.map
+rm -f msgbox
 for i in `pick +inbox2`; do
   diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`"
 done
@@ -115,9 +124,10 @@ run_test "printf $i" '10'
 rmm +inbox2 -unlink `pick +inbox2`
 
 # check -mmdf
+start_test "-mmdf"
 run_prog packf +inbox -mmdf <Mail/yes
 inc +inbox2 -file msgbox >/dev/null
-rm -f msgbox .msgbox.map
+rm -f msgbox
 for i in `pick +inbox2`; do
   diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`"
 done
@@ -125,9 +135,10 @@ run_test "printf $i" '10'
 rmm +inbox2 -unlink `pick +inbox2`
 
 # check append to existing mmdf file
+start_test "append to existing mmdf file"
 run_prog packf +inbox -mmdf <Mail/yes
 inc +inbox2 -file msgbox >/dev/null
-rm -f msgbox .msgbox.map
+rm -f msgbox
 for i in `pick +inbox2`; do
   if [ $i -le 10 ]; then
     diff "`mhpath +inbox $i`" "`mhpath +inbox2 $i`"
@@ -140,4 +151,5 @@ run_test "printf $i" '10'
 rmm +inbox2 -unlink `pick +inbox2`
 
 
+finish_test
 exit ${failed:-0}