]> diplodocus.org Git - nmh/blobdiff - test/bad-input/test-header
Remove the --disable-locale configure option and make locale support
[nmh] / test / bad-input / test-header
index 0e210dbab32bf61f568b4fe0b42f0d79d60bc6b3..1bc05f47a6ba395211826db6b3779ee320f9dd6a 100755 (executable)
@@ -5,6 +5,8 @@
 #
 ######################################################
 
 #
 ######################################################
 
+set -e
+
 if test -z "${MH_OBJ_DIR}"; then
     srcdir=`dirname "$0"`/../..
     MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
 if test -z "${MH_OBJ_DIR}"; then
     srcdir=`dirname "$0"`/../..
     MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
@@ -35,7 +37,7 @@ EOF
 cat >"$expected" <<EOF
   11  12/18 foo@example.edu    test<<This is a multi-part message in MIME forma
 EOF
 cat >"$expected" <<EOF
   11  12/18 foo@example.edu    test<<This is a multi-part message in MIME forma
 EOF
-scan -width 80 last > "$actual" 2>&1
+run_prog scan -width 80 last > "$actual" 2>&1
 check "$expected" "$actual"
 
 # check show (mhl)
 check "$expected" "$actual"
 
 # check show (mhl)
@@ -52,7 +54,7 @@ This is a multi-part message in MIME format.
 
 I am a stupid spammer.
 EOF
 
 I am a stupid spammer.
 EOF
-show last > "$actual" 2>&1
+run_prog show last > "$actual" 2>&1
 check "$expected" "$actual"
 
 # check mhshow
 check "$expected" "$actual"
 
 # check mhshow
@@ -69,7 +71,7 @@ This is a multi-part message in MIME format.
 
 I am a stupid spammer.
 EOF
 
 I am a stupid spammer.
 EOF
-mhshow -nopause last > "$actual" 2>&1
+run_prog mhshow -nopause last > "$actual" 2>&1
 check "$expected" "$actual"
 
 # check m_getfld() handling of empty header field
 check "$expected" "$actual"
 
 # check m_getfld() handling of empty header field
@@ -83,7 +85,7 @@ scan: eof encountered in field "Received"
 ??Format error (message 12) in component 2
 EOF
 
 ??Format error (message 12) in component 2
 EOF
 
-scan -width 13 last >"$actual" 2>"$actual_err"
+run_prog scan -width 13 last >"$actual" 2>"$actual_err"
 check "$expected" "$actual"
 check "$expected_err" "$actual_err"
 
 check "$expected" "$actual"
 check "$expected_err" "$actual_err"
 
@@ -96,14 +98,23 @@ EOF
 cat >"$expected" <<EOF
   13  01/15 
 EOF
 cat >"$expected" <<EOF
   13  01/15 
 EOF
-cat >"$expected_err" <<EOF
-scan: field name "ThisHeaderFieldNameIsWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaayTooLong" exceeds 997 bytes
-??Format error (message 13) in component 2
-EOF
 
 
-scan -width 13 last >"$actual" 2>"$actual_err"
+run_prog scan -width 13 last >"$actual" 2>"$actual_err"
 check "$expected" "$actual"
 check "$expected" "$actual"
-check "$expected_err" "$actual_err"
+# Cygwin has a BUFSIZ of 1024 so the error message gets truncated.
+# Deal with that by grepping to verify that scan showed the proper error.
+verify_string_in_file() {
+  if grep "$1" "$2" >/dev/null; then
+    :
+  else
+    echo "$0: did not receive expected error message \"$1\""
+    failed=`expr ${failed:-0} + 1`
+  fi
+}
+verify_string_in_file 'scan: field name "ThisHeaderFieldNameIsWa' "$actual_err"
+verify_string_in_file 'exceeds 997' "$actual_err"
+verify_string_in_file '??Format error (message 13) in component 2' "$actual_err"
+rm -f "$actual_err"
 
 # check m_getfld() handling of long header field name without a colon
 msgfile="$MH_TEST_DIR/Mail/inbox/14"
 
 # check m_getfld() handling of long header field name without a colon
 msgfile="$MH_TEST_DIR/Mail/inbox/14"
@@ -123,7 +134,7 @@ scan: eol encountered in field "If a header field name has at least 512 characte
 ??Format error (message 14) in component 2
 EOF
 
 ??Format error (message 14) in component 2
 EOF
 
-scan -width 13 last >"$actual" 2>"$actual_err"
+run_prog scan -width 13 last >"$actual" 2>"$actual_err"
 check "$expected" "$actual"
 check "$expected_err" "$actual_err"
 
 check "$expected" "$actual"
 check "$expected_err" "$actual_err"