]> diplodocus.org Git - nmh/blobdiff - test/whom/test-whom
Expanded allowed text in mhical parse error message.
[nmh] / test / whom / test-whom
index 556044620219dc1b3b256886ae48c0d3162981c0..0928fe94077371d35ba1b7e55fa22b3ae9ac8bac 100755 (executable)
@@ -19,6 +19,8 @@ fi
 
 setup_test
 
+check_exit '-eq 1' whom -
+
 expected=$MH_TEST_DIR/$$.expected
 actual=$MH_TEST_DIR/$$.actual
 
@@ -32,23 +34,56 @@ Subject: Testing message 1
 This is a draft message.
 EOF
 
+# check -help
+start_test "-help"
+# Only look at first 10 lines because the rest depend on
+# whether sasl support was configured in.
+cat >$expected <<EOF
+Usage: whom [switches] [file]
+  switches are:
+  -alias aliasfile
+  -[no]check
+  -draft
+  -(draftf)older +folder
+  -(draftm)essage msg
+  -nodraftfolder
+  -version
+  -help
+EOF
+
+run_prog whom -help 2>&1 | head -10 >$actual
+check $expected $actual
+
+# check -version
+start_test "-version"
+case `whom -v` in
+  whom\ --*) ;;
+  *       ) echo "$0: whom -v generated unexpected output" 1>&2
+            failed=`expr ${failed:-0} + 1`;;
+esac
+
 # check with no options
+start_test "with no options"
 run_test 'whom' '  -- Network Recipients --
   user at example.com'
 
 # check -nocheck
+start_test "-nocheck"
 run_test 'whom -check -nocheck' '  -- Network Recipients --
   user at example.com'
 
 # check with file specified
+start_test "with file specified"
 run_test "whom $MH_TEST_DIR/Mail/draft" '  -- Network Recipients --
   user at example.com'
 
 # check -draftmessage
+start_test "-draftmessage"
 run_test "whom -draftm draft" '  -- Network Recipients --
   user at example.com'
 
 # check -draftfolder with -draftmessage
+start_test "-draftfolder with -draftmessage"
 folder +drafts -create >/dev/null
 folder +inbox -fast >/dev/null
 cp $MH_TEST_DIR/Mail/draft $MH_TEST_DIR/Mail/drafts/1
@@ -57,23 +92,27 @@ run_test "whom -draftfolder +drafts -draftm 1" \
   user at example.com'
 
 # check -draftfolder with current draftmessage
+start_test "-draftfolder with current draftmessage"
 folder +drafts 1 >/dev/null
 run_test "whom -draftfolder +drafts" \
 '  -- Network Recipients --
   user at example.com'
 
 # check -nodraftfolder
+start_test "-nodraftfolder"
 run_test 'whom -draftfolder +nonexistent -nodraftfolder' \
 '  -- Network Recipients --
   user at example.com'
 
 # check -draft, though I'm not sure that it's useful.  Note that it
+start_test "-draft, though I'm not sure that it's useful.  Note that it"
 # must appear after the file argument when run standalone.
 run_test "whom $MH_TEST_DIR/Mail/drafts/1 -draft" \
 '  -- Network Recipients --
   user at example.com'
 
 # check -alias
+start_test "-alias"
 rm -f $MH_TEST_DIR/Mail/draft
 cat >$MH_TEST_DIR/Mail/draft <<'EOF'
 From: Test1 <test1@example.com>
@@ -90,8 +129,10 @@ run_test 'whom -alias nmhaliases' '  -- Network Recipients --
   user1 at example.com'
 
 # check -alias with nonexistent aliasfile
+start_test "-alias with nonexistent aliasfile"
 run_test 'whom -alias nonexistent' \
 "whom: aliasing error in nonexistent - unable to read 'nonexistent'"
 
 
+finish_test
 exit $failed