]> diplodocus.org Git - nmh/blobdiff - test/ali/test-ali
Fixed mhical(1) exit status to reflect return status of icalparse().
[nmh] / test / ali / test-ali
index 5dda0e5bbc2dbe35b64cf723a96fafc24b74282e..982cff789e6d8e941689b290fc1eb5abb7cf64ec 100755 (executable)
@@ -19,6 +19,13 @@ fi
 
 setup_test
 
 
 setup_test
 
+check_exit '-eq 1' ali -
+check_exit '-eq 1' ali -noalias -alias
+check_exit '-eq 1' ali -user
+check_exit '-eq 1' ali -user ''
+check_exit '-eq 1' ali -user 'foo bar'
+check_exit '-eq 0' ali -user foo,bar
+
 expected=$MH_TEST_DIR/$$.expected
 expected_err=$MH_TEST_DIR/$$.expected_err
 actual=$MH_TEST_DIR/$$.actual
 expected=$MH_TEST_DIR/$$.expected
 expected_err=$MH_TEST_DIR/$$.expected_err
 actual=$MH_TEST_DIR/$$.actual
@@ -26,6 +33,7 @@ actual_err=$MH_TEST_DIR/$$.actual_err
 
 
 # check -help
 
 
 # check -help
+start_test "-help"
 cat >$expected <<EOF
 Usage: ali [switches] aliases ...
   switches are:
 cat >$expected <<EOF
 Usage: ali [switches] aliases ...
   switches are:
@@ -37,10 +45,12 @@ Usage: ali [switches] aliases ...
   -help
 EOF
 
   -help
 EOF
 
-ali -help >$actual 2>&1
-check $expected $actual
+#### Skip nmh intro text.
+ali -help 2>&1 | sed '/^$/,$d' >"$actual"
+check "$expected" "$actual"
 
 # check -version
 
 # check -version
+start_test "-version"
 case `ali -v` in
   ali\ --*) ;;
   *       ) echo "$0: ali -v generated unexpected output" 1>&2
 case `ali -v` in
   ali\ --*) ;;
   *       ) echo "$0: ali -v generated unexpected output" 1>&2
@@ -48,12 +58,15 @@ case `ali -v` in
 esac
 
 # check unknown option
 esac
 
 # check unknown option
+start_test "unknown option"
 run_test 'ali -nonexistent' 'ali: -nonexistent unknown'
 
 # check with no arguments and no AliasFile profile component
 run_test 'ali -nonexistent' 'ali: -nonexistent unknown'
 
 # check with no arguments and no AliasFile profile component
+start_test "with no arguments and no AliasFile profile component"
 run_test 'ali' ''
 
 # check with nonexistent alias file
 run_test 'ali' ''
 
 # check with nonexistent alias file
+start_test "with nonexistent alias file"
 run_test 'ali -alias nonexistent' \
          "ali: aliasing error in nonexistent - unable to read 'nonexistent'"
 
 run_test 'ali -alias nonexistent' \
          "ali: aliasing error in nonexistent - unable to read 'nonexistent'"
 
@@ -66,6 +79,7 @@ neil: neil@example.com
 EOF
 
 # check -alias
 EOF
 
 # check -alias
+start_test "-alias"
 run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases" \
          'me: me@example.com
 rush: geddy@example.com, alex@example.com, neil@example.com
 run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases" \
          'me: me@example.com
 rush: geddy@example.com, alex@example.com, neil@example.com
@@ -74,14 +88,17 @@ alex: alex@example.com
 neil: neil@example.com'
 
 # check for a specific alias
 neil: neil@example.com'
 
 # check for a specific alias
+start_test "for a specific alias"
 run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases rush" \
          'geddy@example.com, alex@example.com, neil@example.com'
 
 # check for a specific alias that doesn't exist
 run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases rush" \
          'geddy@example.com, alex@example.com, neil@example.com'
 
 # check for a specific alias that doesn't exist
+start_test "for a specific alias that doesn't exist"
 run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases nonexistent" \
          'nonexistent'
 
 # check -list
 run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases nonexistent" \
          'nonexistent'
 
 # check -list
+start_test "-list"
 run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases -list" \
          'me: me@example.com
 rush: geddy@example.com
 run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases -list" \
          'me: me@example.com
 rush: geddy@example.com
@@ -92,6 +109,7 @@ alex: alex@example.com
 neil: neil@example.com'
 
 # check -nolist, which is the default
 neil: neil@example.com'
 
 # check -nolist, which is the default
+start_test "-nolist, which is the default"
 run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases -list -nolist" \
          'me: me@example.com
 rush: geddy@example.com, alex@example.com, neil@example.com
 run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases -list -nolist" \
          'me: me@example.com
 rush: geddy@example.com, alex@example.com, neil@example.com
@@ -100,15 +118,18 @@ alex: alex@example.com
 neil: neil@example.com'
 
 # check -user
 neil: neil@example.com'
 
 # check -user
+start_test "-user"
 run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases -user geddy@example.com" \
          'rush, geddy'
 
 # check -nouser
 run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases -user geddy@example.com" \
          'rush, geddy'
 
 # check -nouser
+start_test "-nouser"
 run_test \
   "ali -alias ${MH_TEST_DIR}/Mail/aliases -user -nouser geddy@example.com" \
   'geddy@example.com'
 
 # check expansion of first address of blind list [Bug #15604]
 run_test \
   "ali -alias ${MH_TEST_DIR}/Mail/aliases -user -nouser geddy@example.com" \
   'geddy@example.com'
 
 # check expansion of first address of blind list [Bug #15604]
+start_test "expansion of first address of blind list [Bug #15604]"
 cat >"${MH_TEST_DIR}/Mail/aliases" <<EOF
 rush: Rush: geddy, alex, neil
 geddy: geddy@example.com
 cat >"${MH_TEST_DIR}/Mail/aliases" <<EOF
 rush: Rush: geddy, alex, neil
 geddy: geddy@example.com
@@ -120,6 +141,7 @@ run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases rush" \
          'Rush: geddy@example.com, alex@example.com, neil@example.com'
 
 # check that aliases followed by ; are not expanded [Bug #15604]
          'Rush: geddy@example.com, alex@example.com, neil@example.com'
 
 # check that aliases followed by ; are not expanded [Bug #15604]
+start_test "that aliases followed by ; are not expanded [Bug #15604]"
 cat >"${MH_TEST_DIR}/Mail/aliases" <<EOF
 rush: Rush: geddy, alex, neil;
 geddy: geddy@example.com
 cat >"${MH_TEST_DIR}/Mail/aliases" <<EOF
 rush: Rush: geddy, alex, neil;
 geddy: geddy@example.com
@@ -130,5 +152,5 @@ EOF
 run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases rush" \
          'Rush: geddy@example.com, alex@example.com, neil;'
 
 run_test "ali -alias ${MH_TEST_DIR}/Mail/aliases rush" \
          'Rush: geddy@example.com, alex@example.com, neil;'
 
-
+finish_test
 exit $failed
 exit $failed