]> diplodocus.org Git - nmh/blobdiff - test/repl/test-convert
uip/prompter.c: Delete obfuscating ERASE, etc., macros.
[nmh] / test / repl / test-convert
index e85c9ccd7c1c1dbd1308d27c46a00f386a75937c..f2792a69e33d1e2963536f952d71705806d976a2 100755 (executable)
@@ -17,10 +17,15 @@ fi
 expected="$MH_TEST_DIR/test-convert$$.expected"
 actual=`mhpath +`/draft
 
-printf 'Local-Mailbox: recipient@example.com' >>"$MH"
+printf 'Local-Mailbox: recipient@example.com\n' >>"$MH"
+
+
+#### Make sure that this works with 7-bit encoding.
+LC_ALL=C; export LC_ALL
 
 
 # check -convertarg with multiple parts and additional text in draft
+start_test '-convertarg with multiple parts and additional text in draft'
 cat >"$expected" <<'EOF'
 From: recipient@example.com
 To: sender@example.com
@@ -69,12 +74,61 @@ mhbuild "$actual"
 check "$actual" "$expected"
 
 
+# check that text is not quoted-printable encoded
+# This tests the setting of reply_ct->c_reqencoding and
+# (*text_plain_ct)->c_reqencoding in expand_pseudoheader().
+start_test "don't encode text as quoted-printable"
+cat >"$expected" <<'EOF'
+From: recipient@example.com
+To: sender@example.com
+cc: 
+Fcc: +outbox
+Subject: Re: test
+Comments: In-reply-to sender@example.com
+   message dated "Thu, 11 Dec 2014 08:19:02 -0600."
+MIME-Version: 1.0
+Content-Type: text/plain; charset="US-ASCII"
+
+sender@example.com writes:
+
+> This is a very, very, very, very, very, very, very, very, very, very, very, long line.
+EOF
+
+cat >`mhpath new` <<'EOF'
+From: sender@example.com
+To: recipient@example.com
+Subject: test
+Date: Thu, 11 Dec 2014 08:19:02 -0600
+Content-Type: multipart/mixed; boundary="_001_"
+MIME-Version: 1.0
+
+--_001_
+Content-Type: text/plain
+
+This is a very, very, very, very, very, very, very, very, very, very, very, long line.
+
+--_001_--
+EOF
+
+#### Just prefix the text with "> ".
+cp "${MH}" "${MH}.new"
+cat >>"${MH}.new" <<EOF
+mhbuild-convert-text: sed 's/^\(.\)/> \1/; s/^$/>/;' <%F
+EOF
+repl -filter mhl.replywithoutbody -convertarg text/plain '' \
+     -nowhatnowproc last
+MH="${MH}.new" mhbuild "$actual"
+rm "${MH}.new"
+check "$actual" "$expected"
+
+
 #### Make sure that this works with 8-bit encoding.
-require_locale en_US.utf-8 en_US.utf8
-LC_ALL=en_US.UTF-8; export LC_ALL
+finish_test
+require_locale en_US.UTF-8 en_US.UTF8 en_US.utf-8 en_US.utf8
 
 
-# check -convertarg with multiple parts and no additional text in draft
+# check -convertarg with multiple parts, 7 bit
+start_test '-convertarg with multiple parts, 7 bit'
 cat >"$expected" <<'EOF'
 From: recipient@example.com
 To: sender@example.com
@@ -85,7 +139,6 @@ Comments: In-reply-to sender@example.com
    message dated "Thu, 11 Dec 2014 08:19:02 -0600."
 MIME-Version: 1.0
 Content-Type: text/plain; charset="UTF-8"
-Content-Transfer-Encoding: 8bit
 
 sender@example.com writes:
 
@@ -108,7 +161,7 @@ Content-Type: text/plain
 This is part 1.
 
 --_001_
-Content-Type: text/plain
+Content-Type: text/plain; charset="UTF-8"
 
 This is part 2.
 
@@ -120,7 +173,55 @@ mhbuild "$actual"
 check "$actual" "$expected"
 
 
+# check -convertarg with multiple parts, 8 bit
+start_test '-convertarg with multiple parts, 8 bit'
+cat >"$expected" <<'EOF'
+From: recipient@example.com
+To: sender@example.com
+cc: 
+Fcc: +outbox
+Subject: Re: test
+Comments: In-reply-to sender@example.com
+   message dated "Thu, 11 Dec 2014 08:19:02 -0600."
+MIME-Version: 1.0
+Content-Type: text/plain; charset="UTF-8"
+Content-Transfer-Encoding: 8bit
+
+sender@example.com writes:
+
+> This is part 1.
+
+> This is §2, with a non-ASCII character.
+EOF
+
+cat >`mhpath new` <<'EOF'
+From: sender@example.com
+To: recipient@example.com
+Subject: test
+Date: Thu, 11 Dec 2014 08:19:02 -0600
+Content-Type: multipart/mixed; boundary="_001_"
+MIME-Version: 1.0
+
+--_001_
+Content-Type: text/plain
+
+This is part 1.
+
+--_001_
+Content-Type: text/plain; charset="UTF-8"
+
+This is §2, with a non-ASCII character.
+
+--_001_--
+EOF
+
+repl -filter mhl.replywithoutbody -convertarg text/plain '' -nowhatnowproc last
+mhbuild "$actual"
+check "$actual" "$expected"
+
+
 # check message with text part in multipart/related
+start_test 'check message with text part in multipart/related'
 cat >"$expected" <<'EOF'
 From: recipient@example.com
 To: sender@example.com
@@ -131,7 +232,6 @@ Comments: In-reply-to sender@example.com
    message dated "."
 MIME-Version: 1.0
 Content-Type: text/plain; charset="UTF-8"
-Content-Transfer-Encoding: 8bit
 
 sender@example.com writes:
 
@@ -149,7 +249,7 @@ MIME-Version: 1.0
 Content-Type: multipart/related; type="text/plain"; boundary="_002_"
 
 --_002_
-Content-Type: text/plain
+Content-Type: text/plain; charset="UTF-8"
 
 This is a test.
 
@@ -164,6 +264,7 @@ check "$actual" "$expected"
 
 
 # check reply to calendar request
+start_test 'check reply to calendar request'
 cat >"$expected" <<'EOF'
 From: recipient@example.com
 To: sender@example.com
@@ -272,4 +373,5 @@ SIGNATURE=Recip mhbuild - <`mhpath +`/draft | egrep -v '^DTSTAMP:' >"$actual"
 check "$actual" "$expected"
 
 
+finish_test
 exit $failed