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
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
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"
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"
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() {
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
EOF
cat > $expected <<EOF
+[ Message inbox:11 ]
Date: Sun, 18 Dec 2005 00:52:39 +0100
To: bar@example.edu
From: foo@example.edu
EOF
run_prog mhshow $msgnum > $actual 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : bogus quoted-printable data
exit $failed
# 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
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
# 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
# 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
# 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
# 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
=\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
# 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"
# 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.
# 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 ]
# 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 ]
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
# check charset conversion
msgfile=`mhpath new`
+msgnum=`basename $msgfile`
cat >"$msgfile" <<'EOF'
From: foo@example.edu
To: bar@example.edu
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
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}
# check expansion of %{charset} by itself
msgfile=`mhpath new`
+msgnum=`basename $msgfile`
cat >"$msgfile" <<'EOF'
From: foo@example.edu
To: bar@example.edu
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
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
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
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"
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
-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
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
-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
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"
# check parameter value quoting
msgfile=`mhpath new`
+msgnum=`basename $msgfile`
cat >"$msgfile" <<'EOF'
From: foo@example.edu
To: bar@example.edu
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
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"
# check that unknown parameter is not expanded
msgfile=`mhpath new`
+msgnum=`basename $msgfile`
cat >"$msgfile" <<'EOF'
From: foo@example.edu
To: bar@example.edu
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
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"
# check parameter value quoting with text following
msgfile=`mhpath new`
+msgnum=`basename $msgfile`
cat >"$msgfile" <<'EOF'
From: foo@example.edu
To: bar@example.edu
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
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
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
=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
EOF
run_prog mhshow last >"$actual" 2>&1
-check "$expected" "$actual"
+check "$expected" "$actual" : large file conversion to UTF-8
exit $failed
# 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
# 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>
[ 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