]> diplodocus.org Git - nmh/commitdiff
Moved test of empty header field from
authorDavid Levine <levinedl@acm.org>
Mon, 14 Jan 2013 15:45:23 +0000 (09:45 -0600)
committerDavid Levine <levinedl@acm.org>
Mon, 14 Jan 2013 15:45:23 +0000 (09:45 -0600)
test/inc/test-inc-scanout to test/bad-input/test-header.

Makefile.am
test/bad-input/malformed_message.txt [moved from test/inc/malformed_message.txt with 100% similarity]
test/bad-input/test-header
test/inc/md5sums
test/inc/test-inc-scanout

index b8beb22b5cb8a98aadeb2a5fce3f4bd0c8f1ea16..7399af9d6bd0ded830118b5fc2302fa6d085f1c4 100644 (file)
@@ -237,8 +237,9 @@ EXTRA_DIST = config/version.sh sbr/sigmsg.awk etc/mts.conf.in \
             man/unseen.man man/whatnow.man man/whom.man \
             test/README test/fakesendmail $(TESTS) test/inc/deb359167.mbox \
             test/inc/fromline.txt test/inc/msgheader.txt test/inc/filler.txt \
-            test/inc/lots_of_headers.txt test/inc/malformed_message.txt \
-            test/inc/md5sums test/mhmail/attachment.txt \
+            test/inc/lots_of_headers.txt test/inc/md5sums \
+            test/bad-input/malformed_message.txt \
+            test/mhmail/attachment.txt \
             test/post/test-post-common.sh uip/mhmail \
             SPECS/nmh.spec SPECS/build-nmh-cygwin
 
index 9f78b3764df020a39bffc9dd4d4519ff02e924ce..4194b39b7a6eeeeaa525abea0a167b54216f9310 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 ######################################################
 #
-# Test bogus headers (no blank line before body).
+# Test bogus headers (no blank line before body, etc.)
 #
 ######################################################
 
@@ -14,13 +14,16 @@ fi
 
 setup_test
 
-expected=$MH_TEST_DIR/$$.expected
-actual=$MH_TEST_DIR/$$.actual
+thisdir="$srcdir/test/bad-input"
+expected="$MH_TEST_DIR/$$.expected"
+expected_err="$MH_TEST_DIR/$$.expected_err"
+actual="$MH_TEST_DIR/$$.actual"
+actual_err="$MH_TEST_DIR/$$.actual_err"
 
 # Write message with bogus header field (missing blank line, really).
 msgfile=`mhpath new`
 msgnum=`basename $msgfile`
-cat > $msgfile <<EOF
+cat > "$msgfile" <<EOF
 Date: Sun, 18 Dec 2005 00:52:39 +0100
 From: foo@example.edu
 To: bar@example.edu
@@ -31,14 +34,14 @@ I am a stupid spammer.
 EOF
 
 # check scan
-cat > $expected <<EOF
+cat > "$expected" <<EOF
   11  12/18 foo@example.edu    test<<This is a multi-part message in MIME forma
 EOF
-scan -width 80 $msgnum > $actual 2>&1
-check $expected $actual
+scan -width 80 $msgnum > "$actual" 2>&1
+check "$expected" "$actual"
 
 # check show (mhl)
-cat > $expected <<EOF
+cat > "$expected" <<EOF
 (Message inbox:11)
 
 Date:    Sun, 18 Dec 2005 00:52:39 +0100
@@ -51,11 +54,11 @@ This is a multi-part message in MIME format.
 
 I am a stupid spammer.
 EOF
-show $msgnum > $actual 2>&1
-check $expected $actual
+show $msgnum > "$actual" 2>&1
+check "$expected" "$actual"
 
 # check mhshow
-cat > $expected <<EOF
+cat > "$expected" <<EOF
 Date:    Sun, 18 Dec 2005 00:52:39 +0100
 To:      bar@example.edu
 From:    foo@example.edu
@@ -68,7 +71,22 @@ This is a multi-part message in MIME format.
 
 I am a stupid spammer.
 EOF
-mhshow -nopause $msgnum > $actual 2>&1
-check $expected $actual
+mhshow -nopause $msgnum > "$actual" 2>&1
+check "$expected" "$actual"
+
+# check m_getfld() handling of empty header field
+cat >"$expected" <<EOF
+   1  01/12 
+EOF
+cat >"$expected_err" <<EOF
+scan: eof encountered in field "Received"
+??Format error (message -1) in component 2
+EOF
+
+scan -width 13 -file "$thisdir"/malformed_message.txt >"$actual" 2>"$actual_err"
+
+check "$expected" "$actual"
+check "$expected_err" "$actual_err"
+
 
 exit $failed
index fd448308827c09cf53a70c5cae05c00ef562e611..4bffa9fbd3da1e3ce4451e0f7a9a668278cf0704 100644 (file)
@@ -1,5 +1,4 @@
 4112b1460e11bd94d30944dd464a6662  filler.txt
 023aad60eab43f06cf525869a833beb4  fromline.txt
 0c4fd7cd528519e83011015bfae3e458  lots_of_headers.txt
-c5bf54a59425ee730080e71b64162840  malformed_message.txt
 4fda7f16b29d757413cb928d6ffc5aa5  msgheader.txt
index 7826af457642f3a91958ef88bb90980aa72fd23d..adc7867acf69a2058573b8647e37c14d2a2199ad 100755 (executable)
@@ -17,9 +17,7 @@ setup_test
 
 thisdir="$srcdir/test/inc"
 expected="$MH_TEST_DIR/$$.expected"
-expected_err="$MH_TEST_DIR/$$.expected_err"
 actual="$MH_TEST_DIR/$$.actual"
-actual_err="$MH_TEST_DIR/$$.actual_err"
 
 cat > "${MH_TEST_DIR}/test.mbox" <<EOF
 From nobody@nowhereville Jan 1 1970
@@ -205,14 +203,6 @@ run_test "scan -width 120 +inbox 11" \
 run_test "scan -width 60 -file $thisdir/lots_of_headers.txt" \
          '   1  01/10 No Such User       all that and nothing to say?'
 
-cat >"$expected" <<EOF
-   1  01/12 
-EOF
-cat >"$expected_err" <<EOF
-scan: eof encountered in field "Received"
-??Format error (message -1) in component 2
-EOF
-
 # check m_getfld() handling of fields with trailing whitespace
 # Even though header field names aren't supposed to have spaces (RFC
 # 28220, m_getfld () trims trailing whitespace from them.
@@ -225,11 +215,4 @@ EOF
 run_test 'scan last' '  12  12/18 foo@example.edu    test'
 
 
-# check m_getfld() handling of empty header field
-scan -width 13 -file "$thisdir"/malformed_message.txt >"$actual" 2>"$actual_err"
-
-check "$expected" "$actual"
-check "$expected_err" "$actual_err"
-
-
 exit ${failed:-0}