]> diplodocus.org Git - nmh/commitdiff
update tests for new message separator header from mhshow
authorPaul Fox <pgf@foxharp.boston.ma.us>
Sun, 8 Feb 2015 20:13:31 +0000 (15:13 -0500)
committerPaul Fox <pgf@foxharp.boston.ma.us>
Sun, 8 Feb 2015 22:01:58 +0000 (17:01 -0500)
also added test names to tests, in any file i touched

test/bad-input/test-header
test/mhshow/test-charset
test/mhshow/test-cte-binary
test/mhshow/test-msg-buffer-boundaries
test/mhshow/test-qp
test/mhshow/test-subpart
test/mhshow/test-textcharset
test/show/test-show

index 1716ff1f1098ad6e3461e0a3c616986ed1bf520e..eeacc831397e7eaaf34e226e0741232dcf5f287a 100755 (executable)
@@ -38,7 +38,7 @@ cat >"$expected" <<EOF
   11  12/18 foo@example.edu    test<<This is a multi-part message in MIME format
 EOF
 run_prog scan -width 80 last > "$actual" 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : scan with bogus header field
 
 # check show (mhl)
 cat >"$expected" <<EOF
@@ -55,10 +55,11 @@ This is a multi-part message in MIME format.
 I am a stupid spammer.
 EOF
 run_prog show last > "$actual" 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : "show (mhl) with bogus header field"
 
 # check mhshow
 cat >"$expected" <<EOF
+[ Message inbox:11 ]
 Date:    Sun, 18 Dec 2005 00:52:39 +0100
 To:      bar@example.edu
 From:    foo@example.edu
@@ -72,7 +73,7 @@ This is a multi-part message in MIME format.
 I am a stupid spammer.
 EOF
 run_prog mhshow last > "$actual" 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : mhshow with bogus header field
 
 # check m_getfld() handling of empty header field
 msgfile="$MH_TEST_DIR/Mail/inbox/12"
@@ -86,8 +87,8 @@ scan: eof encountered in field "Received"
 EOF
 
 run_prog scan -width 13 last >"$actual" 2>"$actual_err"
-check "$expected" "$actual"
-check "$expected_err" "$actual_err"
+check "$expected" "$actual" : m_getfld, empty header output
+check "$expected_err" "$actual_err" : m_getfld, empty header error
 
 # check m_getfld() handling of excessively long header field name
 msgfile="$MH_TEST_DIR/Mail/inbox/13"
@@ -100,7 +101,7 @@ cat >"$expected" <<EOF
 EOF
 
 run_prog scan -width 13 last >"$actual" 2>"$actual_err"
-check "$expected" "$actual"
+check "$expected" "$actual" : m_getfld with excessively long header field name
 # 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() {
@@ -135,8 +136,8 @@ scan: eol encountered in field "If a header field name has at least 512 characte
 EOF
 
 run_prog scan -width 13 last >"$actual" 2>"$actual_err"
-check "$expected" "$actual"
-check "$expected_err" "$actual_err"
+check "$expected" "$actual" : m_getfld with long header, no colon output
+check "$expected_err" "$actual_err" : m_getfld with long header, no colon error
 
 
 exit $failed
index e0a0b6e83440a46c51e213872a3f6e08bbf1c375..6c3c763a263252291ac5bada32dc70a07a849caf 100755 (executable)
@@ -43,6 +43,7 @@ Date: Sun, 18 Dec 2005 00:52:39 +0100
 EOF
 
 cat > $expected <<EOF
+[ Message inbox:11 ]
 Date:    Sun, 18 Dec 2005 00:52:39 +0100
 To:      bar@example.edu
 From:    foo@example.edu
@@ -56,6 +57,6 @@ This is a test
 EOF
 
 run_prog mhshow $msgnum > $actual 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : bogus quoted-printable data
 
 exit $failed
index fdf1ca78442160aabd78ea801e49f3d2b8b3f3fa..f872e3b0b0b103fb0dd2891b82f8c1068bd4aec0 100755 (executable)
@@ -35,6 +35,7 @@ EOF
 
 # check it
 cat > $expected <<EOF
+[ Message inbox:11 ]
 Date:    Tue, 05 Mar 2002 18:20:35 +0000
 To:      bar@example.edu
 From:    foo@example.edu
@@ -47,7 +48,7 @@ Content-Disposition: inline
 This is a test; this is the body.
 EOF
 run_prog mhshow $msgnum > $actual 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : C-T-E binary text
 
 exit $failed
 
index 47005cc9b15ab918977aea64440a1d517d763e4a..ca1e7cd62e43d87644752c54beffc2d6ddad42ec 100755 (executable)
@@ -153,12 +153,13 @@ EOF
 
 # Write the expected output.
 cat >"$expected" <<EOF
+[ Message inbox:$msgnum ]
 [ part 1.1 - text/plain -   29B  ]
 This is the text/plain part.
 EOF
 
 run_prog mhshow -part 1.1 -form mhl.null $msgnum >"$actual" 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : check number 1
 
 # check a boundary condition in m_getfld():  its internal message
 # buffer holds exactly up to the end of a header field name in a
@@ -293,12 +294,13 @@ EOF
 
 # Write the expected output.
 cat >"$expected" <<EOF
+[ Message inbox:$msgnum ]
 [ part 1.1 - text/plain -   29B  ]
 This is the text/plain part.
 EOF
 
 run_prog mhshow -part 1.1 -form mhl.null $msgnum >"$actual" 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : check number 2
 
 # check a boundary condition in m_getfld():  its internal message
 # buffer holds exactly up to the end of a message part boundary
@@ -434,12 +436,13 @@ EOF
 
 # Write the expected output.
 cat >"$expected" <<EOF
+[ Message inbox:$msgnum ]
 [ part 1.1 - text/plain - the text/plain part  29B  ]
 This is the text/plain part.
 EOF
 
 run_prog mhshow -part 1.1 -form mhl.null $msgnum >"$actual" 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : check number 3
 
 
 exit $failed
index dae70a5a0f850d4728c2764953a3d8286fe4bc8e..1b78c8eac02b6eecac48b348bfe7e4e675f88236 100755 (executable)
@@ -47,6 +47,7 @@ EOF
 
 # check it
 cat > $expected <<EOF
+[ Message inbox:11 ]
 Date:    Sun, 18 Dec 2005 00:52:39 +0100
 To:      bar@example.edu
 From:    foo@example.edu
@@ -69,6 +70,6 @@ just a newline
 =\b ^H (backspace) character, probably erased = in diff output
 EOF
 run_prog mhshow $msgnum > $actual 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : bogus quoted-printable data
 
 exit $failed
index 161dceab7ead9a3d319da2f15b0a1703856d9956..28bca944ff9be57c7b61ec410fee4d97150c4e05 100755 (executable)
@@ -51,18 +51,22 @@ EOF
 
 # Write the expected output.
 cat > $expected <<EOF
+[ Message inbox:11 ]
 [ part 1.1 - text/plain -   29B  ]
 This is the text/plain part.
 EOF
 
 # check it
 run_prog mhshow -part 1.1 -form mhl.null $msgnum > $actual 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : part 1.1
+
+
+# tests of -part/-type/-prefer
 
 cat > $msgfile <<EOF
 To: example@example.org
 From: someone <someone@example.com>
-Subject: mhshow -part/-type/prefer test
+Subject: mhshow -part/-type/-prefer test
 Date: Thu, 29 Jan 2015 18:12:21 +0000 (GMT)
 Content-Type: multipart/mixed; boundary="BoundaryMixed"
 
@@ -105,36 +109,40 @@ EOF
 
 # Write the expected output.
 cat > $expected <<EOF
+[ Message inbox:11 ]
 [ part 1.1.1 - text/html -   111B  ]
 This is the text/html body part.
 EOF
 
 # check it
 run_prog mhshow -part 1.1.1 -form mhl.null $msgnum > $actual 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : part 1.1.1
 
 # Write the expected output.
 cat > $expected <<EOF
+[ Message inbox:11 ]
 [ part 1.2 - text/plain -   33B  ]
 This is the body text/plain part.
 EOF
 
 # check it
 run_prog mhshow -part 1.2 -form mhl.null $msgnum > $actual 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : part 1.2
 
 # Write the expected output.
 cat > $expected <<EOF
+[ Message inbox:11 ]
 [ part 1.1 - text/plain -   33B  ]
 This is the body text/plain part.
 EOF
 
 # check it
 run_prog mhshow -prefer text/plain -part 1 -form mhl.null $msgnum > $actual 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : part conflicting text/plain, part 1 switches
 
 # Write the expected output.
 cat > $expected <<EOF
+[ Message inbox:11 ]
 [ part 2 - text/plain -   93B  ]
 _______________________________________________
 This is the final text/plain signature part.
@@ -142,10 +150,11 @@ EOF
 
 # check it
 run_prog mhshow -part 2 -form mhl.null $msgnum > $actual 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : part 2
 
 # Write the expected output.
 cat > $expected <<EOF
+[ Message inbox:11 ]
 [ part 1.2 - text/plain -   33B  ]
 This is the body text/plain part.
 [ part 2 - text/plain -   93B  ]
@@ -155,10 +164,11 @@ EOF
 
 # check it
 run_prog mhshow -type text/plain -form mhl.null $msgnum > $actual 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : type text/plain
 
 # Write the expected output.
 cat > $expected <<EOF
+[ Message inbox:11 ]
 [ part 1.1 - text/plain -   33B  ]
 This is the body text/plain part.
 [ part 2 - text/plain -   93B  ]
@@ -167,6 +177,6 @@ This is the final text/plain signature part.
 EOF
 
 run_prog mhshow -prefer text/plain -form mhl.null $msgnum > $actual 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : prefer text/plain
 
 exit $failed
index d4d7ef0709ce06c5eb01baca956306c8e8eead8e..f8d854fc1428d7117a7e3e4d627b388a47a97486 100755 (executable)
@@ -28,6 +28,7 @@ actual="$MH_TEST_DIR"/$$.actual
 
 # check charset conversion
 msgfile=`mhpath new`
+msgnum=`basename $msgfile`
 cat >"$msgfile" <<'EOF'
 From: foo@example.edu
 To: bar@example.edu
@@ -40,7 +41,8 @@ Date: Sun, 18 Dec 2005 00:52:39 +0100
 4 =F7 2 =3D 2
 EOF
 
-cat >"$expected" <<'EOF'
+cat >"$expected" <<EOF
+[ Message inbox:$msgnum ]
 Date:    Sun, 18 Dec 2005 00:52:39 +0100
 To:      bar@example.edu
 From:    foo@example.edu
@@ -53,7 +55,7 @@ MIME-Version: 1.0
 EOF
 
 run_prog mhshow last >"$actual" 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : check charset conversion
 
 cat >>"$MH" <<'EOF'
 mhshow-show-text/plain: echo %{charset}
@@ -62,6 +64,7 @@ EOF
 
 # check expansion of %{charset} by itself
 msgfile=`mhpath new`
+msgnum=`basename $msgfile`
 cat >"$msgfile" <<'EOF'
 From: foo@example.edu
 To: bar@example.edu
@@ -74,7 +77,8 @@ Date: Sun, 18 Dec 2005 00:52:39 +0100
 4 =F7 2 =3D 2
 EOF
 
-cat >"$expected" <<'EOF'
+cat >"$expected" <<EOF
+[ Message inbox:$msgnum ]
 Date:    Sun, 18 Dec 2005 00:52:39 +0100
 To:      bar@example.edu
 From:    foo@example.edu
@@ -86,11 +90,13 @@ UTF-8
 EOF
 
 run_prog mhshow last >"$actual" 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : check %{charset} by itself
 
 
 # check expansion of empty %{charset} by itself
 msgfile=`mhpath new`
+omsgnum=$msgnum
+msgnum=`basename $msgfile`
 cat >"$msgfile" <<'EOF'
 From: foo@example.edu
 To: bar@example.edu
@@ -103,7 +109,8 @@ Date: Sun, 18 Dec 2005 00:52:39 +0100
 4 =F7 2 =3D 2
 EOF
 
-cat >"$expected" <<'EOF'
+cat >"$expected" <<EOF
+[ Message inbox:$msgnum ]
 Date:    Sun, 18 Dec 2005 00:52:39 +0100
 To:      bar@example.edu
 From:    foo@example.edu
@@ -115,7 +122,7 @@ MIME-Version: 1.0
 EOF
 
 run_prog mhshow last >"$actual" 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : check empty %{charset} by itself
 
 
 grep -v 'mhshow-show-text/plain:' "$MH" >"$MH.new"
@@ -125,7 +132,8 @@ mhshow-show-text/plain: charset=%{charset}; echo ${charset:+-I $charset}
 EOF
 
 # check expansion of embedded %{charset} with no text following
-cat >"$expected" <<'EOF'
+cat >"$expected" <<EOF
+[ Message inbox:$omsgnum ]
 Date:    Sun, 18 Dec 2005 00:52:39 +0100
 To:      bar@example.edu
 From:    foo@example.edu
@@ -136,12 +144,13 @@ MIME-Version: 1.0
 -I UTF-8
 EOF
 
-run_prog mhshow prev >"$actual" 2>&1
-check "$expected" "$actual"
+run_prog mhshow prev >"$actual" 2>&1   # NB:  "mhshow prev" !!!
+check "$expected" "$actual" : check embedded %{charset} with no text
 
 
 # check expansion of empty embedded %{charset} with no text following
-cat >"$expected" <<'EOF'
+cat >"$expected" <<EOF
+[ Message inbox:$msgnum ]
 Date:    Sun, 18 Dec 2005 00:52:39 +0100
 To:      bar@example.edu
 From:    foo@example.edu
@@ -153,14 +162,15 @@ MIME-Version: 1.0
 EOF
 
 run_prog mhshow last >"$actual" 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : check empty embedded %{charset} with no text following
 
 
 sed -e 's%\(mhshow-show-text/plain:.*\)%\1 file%' "$MH" >"$MH.new"
 mv -f "$MH.new" "$MH"
 
 # check expansion of embedded %{charset} with text following
-cat >"$expected" <<'EOF'
+cat >"$expected" <<EOF
+[ Message inbox:$omsgnum ]
 Date:    Sun, 18 Dec 2005 00:52:39 +0100
 To:      bar@example.edu
 From:    foo@example.edu
@@ -171,12 +181,13 @@ MIME-Version: 1.0
 -I UTF-8 file
 EOF
 
-run_prog mhshow prev >"$actual" 2>&1
-check "$expected" "$actual"
+run_prog mhshow prev >"$actual" 2>&1   # NB:  "mhshow prev" !!!
+check "$expected" "$actual" : check embedded %{charset} with text following
 
 
 # check expansion of empty embedded %{charset} with text following
-cat >"$expected" <<'EOF'
+cat >"$expected" <<EOF
+[ Message inbox:$msgnum ]
 Date:    Sun, 18 Dec 2005 00:52:39 +0100
 To:      bar@example.edu
 From:    foo@example.edu
@@ -188,7 +199,7 @@ file
 EOF
 
 run_prog mhshow last >"$actual" 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : check empty embedded %{charset} with text following
 
 
 sed -e 's/charset/method/g' "$MH" >"$MH.new"
@@ -196,6 +207,7 @@ mv -f "$MH.new" "$MH"
 
 # check parameter value quoting
 msgfile=`mhpath new`
+msgnum=`basename $msgfile`
 cat >"$msgfile" <<'EOF'
 From: foo@example.edu
 To: bar@example.edu
@@ -208,7 +220,10 @@ Date: Sun, 18 Dec 2005 00:52:39 +0100
 4 =F7 2 =3D 2
 EOF
 
-cat >"$expected" <<'EOF'
+cat >"$expected" <<EOF
+[ Message inbox:$msgnum ]
+EOF
+cat >>"$expected" <<'EOF'
 Date:    Sun, 18 Dec 2005 00:52:39 +0100
 To:      bar@example.edu
 From:    foo@example.edu
@@ -220,7 +235,7 @@ MIME-Version: 1.0
 EOF
 
 run_prog mhshow last >"$actual" 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : check parameter value quoting
 
 
 sed -e 's/method/unknown/g' "$MH" >"$MH.new"
@@ -228,6 +243,7 @@ mv -f "$MH.new" "$MH"
 
 # check that unknown parameter is not expanded
 msgfile=`mhpath new`
+msgnum=`basename $msgfile`
 cat >"$msgfile" <<'EOF'
 From: foo@example.edu
 To: bar@example.edu
@@ -240,7 +256,8 @@ Date: Sun, 18 Dec 2005 00:52:39 +0100
 4 =F7 2 =3D 2
 EOF
 
-cat >"$expected" <<'EOF'
+cat >"$expected" <<EOF
+[ Message inbox:$msgnum ]
 Date:    Sun, 18 Dec 2005 00:52:39 +0100
 To:      bar@example.edu
 From:    foo@example.edu
@@ -252,7 +269,7 @@ file
 EOF
 
 run_prog mhshow last >"$actual" 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : check unknown parameter is not expanded
 
 
 grep -v '^mhshow-show-text/plain: ' "$MH" >>"$MH.new"
@@ -263,6 +280,7 @@ EOF
 
 # check parameter value quoting with text following
 msgfile=`mhpath new`
+msgnum=`basename $msgfile`
 cat >"$msgfile" <<'EOF'
 From: foo@example.edu
 To: bar@example.edu
@@ -274,7 +292,8 @@ Date: Sun, 18 Dec 2005 00:52:39 +0100
 This is a test.
 EOF
 
-cat >"$expected" <<'EOF'
+cat >"$expected" <<EOF
+[ Message inbox:$msgnum ]
 Date:    Sun, 18 Dec 2005 00:52:39 +0100
 To:      bar@example.edu
 From:    foo@example.edu
@@ -285,7 +304,7 @@ MIME-Version: 1.0
 EOF
 
 run_prog mhshow last >"$actual" 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : parameter value quoting with text following
 
 #
 # test a large file that needs to be converted to UTF-8
@@ -294,6 +313,7 @@ check "$expected" "$actual"
 grep -v '^mhshow-show-text/plain: ' "$MH" >>"$MH.new"
 mv -f "$MH.new" "$MH"
 msgfile=`mhpath new`
+msgnum=`basename $msgfile`
 cat >"$msgfile" <<'EOF'
 From: foo@example.edu
 To: bar@example.edu
@@ -728,7 +748,8 @@ one of the glass buildings.
 =93How strange!=94 she exclaimed, drawing a long breath.
 EOF
 
-cat >"$expected" <<'EOF'
+cat >"$expected" <<EOF
+[ Message inbox:$msgnum ]
 Date:    Sun, 18 Dec 2005 00:52:39 +0100
 To:      bar@example.edu
 From:    foo@example.edu
@@ -1155,6 +1176,6 @@ one of the glass buildings.
 EOF
 
 run_prog mhshow last >"$actual" 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : large file conversion to UTF-8
 
 exit $failed
index e8cfd44b1ff83f564ef105dc32f21f29af20c400..30d825ceddb540ed71c78e718ce52da772e0997e 100755 (executable)
@@ -77,7 +77,7 @@ check "$expected" "$actual" : show two non-mime
 # Format is different; why?
 
 cat > $expected <<EOF
-(Message inbox:$msgnum)
+[ Message inbox:$msgnum ]
 Date:    Thu, 19 May 2011 00:00:00 -0000
 To:      recipient@example.com
 From:    sender@example.com
@@ -97,9 +97,7 @@ check "$expected" "$actual" : show one MIME
 # Currently fails.
 
 cat > $expected <<EOF
->>> inbox:1
-
-
+[ Message inbox:1 ]
 Date:    Fri, 29 Sep 2006 00:00:00
 To:      Some User <user@example.com>
 From:    Test1 <test1@example.com>
@@ -108,10 +106,7 @@ Subject: Testing message 1
 
 [ part  - text/plain -   25B  ]
 This is message number 1
-
->>> inbox:$msgnum
-
-
+[ Message inbox:11 ]
 Date:    Thu, 19 May 2011 00:00:00 -0000
 To:      recipient@example.com
 From:    sender@example.com