]> diplodocus.org Git - nmh/blobdiff - test/mhfixmsg/test-mhfixmsg
Fix some typos in the comments.
[nmh] / test / mhfixmsg / test-mhfixmsg
index 95f6fa15db3f3c99fd502e3c91ab6a1c3bd6e523..e5df143067875c1a5fcc832af00ac15c8fc74367 100755 (executable)
@@ -70,7 +70,8 @@ Usage: mhfixmsg [+folder] [msgs] [switches]
   -help
 EOF
 
-run_prog mhfixmsg -help >"$actual" 2>&1
+#### Skip nmh intro text.
+run_prog mhfixmsg -help | sed '/^$/,$d' >"$actual" 2>&1
 check "$expected" "$actual"
 
 
@@ -575,7 +576,7 @@ check "$expected" "$actual"
 
 # check attempted (default, 8 bit) -decodetext of binary text
 #### Generated the encoded text below with:
-####   $ printf '\xbd\xb2=\xbc\x00\n' | base64
+####   $ printf '\275\262=\274\000\n' | base64
 start_test "attempted (default, 8 bit) -decodetext of binary text"
 cat >`mhpath new` <<EOF
 To: recipient@example.com
@@ -585,7 +586,7 @@ MIME-Version: 1.0
 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
 
 ------- =_aaaaaaaaaa0
-Content-Type: text/plain; charset=UTF-8; name="nul+square.txt"
+Content-Type: text/plain; charset="UTF-8"; name="nul+square.txt"
 Content-Transfer-Encoding: base64
 
 vbI9vAAK
@@ -719,14 +720,14 @@ check `mhpath last` "$expected"
 
 # check -decodetext of binary (containing ASCII NUL) text
 start_test "-decodetext of binary (containing ASCII NUL) text"
-printf "%s\xbd\xb2=\xbc\x00%s" "To: recipient@example.com
+printf "%s\275\262=\274\000%s" "To: recipient@example.com
 From: sender@example.com
 Subject: mhfixmsg binary decode test
 MIME-Version: 1.0
 Content-Type: multipart/mixed; boundary=\"----- =_aaaaaaaaaa0\"
 
 ------- =_aaaaaaaaaa0
-Content-Type: text/plain; charset=UTF-8; name=\"nul+square.txt\"
+Content-Type: text/plain; charset=\"UTF-8\"; name=\"nul+square.txt\"
 Content-Transfer-Encoding: binary
 
 " "
@@ -832,7 +833,7 @@ Content-Transfer-Encoding: 8bit
 EOF
 
 #### Generated the encoded text below with:
-####   $ printf '\xbd\xb2=\xbc\n' | base64
+####   $ printf '\275\262=\274\n' | base64
 cat >`mhpath new` <<EOF
 To: recipient@example.com
 From: sender@example.com
@@ -1714,6 +1715,64 @@ set -e
 check `mhpath last` "$actual"
 
 
+start_test "fix RFC 2047 encoded header parameters"
+cat >"$expected" <<EOF
+To: recipient@example.com
+From: sender@example.com
+Date: Wed, 28 Sep 2016 11:24:28 -0400
+Subject: invalid header parameter encoding
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary=001a114dd3e8fe9c56053d92f414
+
+--001a114dd3e8fe9c56053d92f414
+
+Content-Type: text/plain; charset=UTF-8
+
+This is a test.
+
+--001a114dd3e8fe9c4a053d92f412--
+
+--001a114dd3e8fe9c56053d92f414
+Content-Type: text/plain; charset="UTF-8"; name*=UTF-8''test%C3%B8.txt
+Content-Disposition: attachment; filename*=UTF-8''test%C3%B8.txt
+Content-Transfer-Encoding: 8bit
+
+This is the first text/plain part, in a subpart.  The file name
+is testø.txt.
+
+--001a114dd3e8fe9c56053d92f414--
+EOF
+
+cat >`mhpath new` <<EOF
+To: recipient@example.com
+From: sender@example.com
+Date: Wed, 28 Sep 2016 11:24:28 -0400
+Subject: invalid header parameter encoding
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary=001a114dd3e8fe9c56053d92f414
+
+--001a114dd3e8fe9c56053d92f414
+
+Content-Type: text/plain; charset=UTF-8
+
+This is a test.
+
+--001a114dd3e8fe9c4a053d92f412--
+
+--001a114dd3e8fe9c56053d92f414
+Content-Type: text/plain; charset=UTF-8; name="=?UTF-8?B?dGVzdMO4LnR4dA==?="
+Content-Disposition: attachment; filename="=?UTF-8?B?dGVzdMO4LnR4dA==?="
+Content-Transfer-Encoding: 8bit
+
+This is the first text/plain part, in a subpart.  The file name
+is testø.txt.
+
+--001a114dd3e8fe9c56053d92f414--
+EOF
+run_prog mhfixmsg -file - -outfile - <`mhpath last` >"$actual" 2>/dev/null
+check "$expected" "$actual"
+
+
 # make sure there are no tmp files left over
 find "$MH_TEST_DIR/Mail" \( -name 'mhfix*' -o -name ',mhfix*' \) -print \
   >"$actual"