]> diplodocus.org Git - nmh/blobdiff - test/mkstemp/test-mkstemp
Update XOAUTH2 documentation.
[nmh] / test / mkstemp / test-mkstemp
index 084f649a7f8ff8ec0cea777d7c684741d4a2fabc..aec8baa8e951225a725b58220e6b63885c33a533 100755 (executable)
@@ -20,12 +20,16 @@ expected="$MH_TEST_DIR"/$$.expected
 actual="$MH_TEST_DIR"/$$.actual
 
 mkstemp="${MH_LIBEXEC_DIR}/mkstemp"
+
+check_exit '-eq 1' $mkstemp -
+
 $mkstemp -help | grep suffix >/dev/null  &&  has_mkstemps=1  ||  has_mkstemps=0
 
 cd "$MHTMPDIR"
 
 
 # check -help
+start_test "-help"
 if [ $has_mkstemps -eq 1 ]; then
     cat >$expected <<-'EOF'
        Usage: mkstemp [switches]
@@ -47,11 +51,13 @@ else
        EOF
 fi
 
-$mkstemp -h >$actual 2>&1
-check $expected $actual
+#### Skip nmh intro text.
+run_prog $mkstemp -h 2>&1 | sed '/^$/,$d' >"$actual"
+check "$expected" "$actual"
 
 
 # check -version
+start_test "-version"
 # Verified same behavior as compiled mhmail.
 case `$mkstemp -v` in
     mkstemp\ --*) ;;
@@ -61,6 +67,7 @@ esac
 
 
 # check with no switches
+start_test "with no switches"
 tmpfile=`$mkstemp`
 if [ -f "$tmpfile" ]; then
     rm "$tmpfile"
@@ -70,6 +77,7 @@ fi
 
 
 # check -directory
+start_test "-directory"
 tmpfile=`$mkstemp -directory "$MHTMPDIR"`
 [ -f "$tmpfile" ]  &&  rm "$tmpfile"  ||  failed=`expr ${failed:-0} + 1`
 # Rely on exit status of grep to detect failure and terminate due to set -e:
@@ -78,6 +86,7 @@ run_test 'eval echo $check_tmpfile' ''
 
 
 # check -prefix
+start_test "-prefix"
 tmpfile=`$mkstemp -prefix mkstemptest`
 [ -f "$tmpfile" ]  &&  rm "$tmpfile"  ||  failed=`expr ${failed:-0} + 1`
 # Rely on exit status of grep to detect failure and terminate due to set -e:
@@ -95,4 +104,5 @@ if [ $has_mkstemps -eq 1 ]; then
 fi
 
 
+finish_test
 exit $failed