expected="$MH_TEST_DIR"/$$.expected
actual="$MH_TEST_DIR"/$$.actual
-mkstemp="${MH_LIB_DIR}/mkstemp"
+mkstemp="${MH_LIBEXEC_DIR}/mkstemp"
+
+check_exit '-eq 255' $mkstemp - # gcov
+
$mkstemp -help | grep suffix >/dev/null && has_mkstemps=1 || has_mkstemps=0
cd "$MHTMPDIR"
EOF
fi
-$mkstemp -h >$actual 2>&1
-check $expected $actual
+#### Skip nmh intro text.
+run_prog $mkstemp -h | sed '/^$/,$d' >"$actual" 2>&1
+check "$expected" "$actual"
# check -version
# check -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:
check_tmpfile=`echo $tmpfile | grep "^$MHTMPDIR/......$" >/dev/null`
-run_test `echo $check_tmpfile` ''
+run_test 'eval echo $check_tmpfile' ''
# check -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:
check_tmpfile=`echo $tmpfile | grep '^mkstemptest......$' >/dev/null`
-run_test `echo $check_tmpfile` ''
+run_test 'eval echo $check_tmpfile' ''
if [ $has_mkstemps -eq 1 ]; then
# check -suffix
tmpfile=`$mkstemp -suffix .txt`
[ -f "$tmpfile" ] && rm "$tmpfile" || failed=`expr ${failed:-0} + 1`
+ # Rely on exit status of grep to detect failure and terminate due to set -e:
check_tmpfile=`echo $tmpfile | grep '^......\.txt$' >/dev/null`
- run_test `echo $check_tmpfile` ''
+ run_test 'eval echo $check_tmpfile' ''
fi