]> diplodocus.org Git - nmh/commitdiff
Beginnings of test suite for RFC 2231 support; does not work yet.
authorKen Hornstein <kenh@pobox.com>
Tue, 25 Feb 2014 02:34:12 +0000 (21:34 -0500)
committerKen Hornstein <kenh@pobox.com>
Tue, 25 Feb 2014 02:34:12 +0000 (21:34 -0500)
Makefile.am
test/mhbuild/test-ext-params [new file with mode: 0755]

index bdcca08..bf933ef 100644 (file)
@@ -67,6 +67,7 @@ TESTS = test/ali/test-ali test/anno/test-anno \
        test/manpages/test-manpages \
        test/mhbuild/test-attach \
        test/mhbuild/test-cte \
        test/manpages/test-manpages \
        test/mhbuild/test-attach \
        test/mhbuild/test-cte \
+       test/mhbuild/test-ext-params \
        test/mhbuild/test-forw test/mhbuild/test-header-encode \
        test/mhbuild/test-utf8-body \
        test/mhfixmsg/test-mhfixmsg \
        test/mhbuild/test-forw test/mhbuild/test-header-encode \
        test/mhbuild/test-utf8-body \
        test/mhfixmsg/test-mhfixmsg \
diff --git a/test/mhbuild/test-ext-params b/test/mhbuild/test-ext-params
new file mode 100755 (executable)
index 0000000..74253f4
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/sh
+######################################################
+#
+# Test the creation of RFC 2231 encoded parameters
+#
+######################################################
+
+if test -z "${MH_OBJ_DIR}"; then
+    srcdir=`dirname "$0"`/../..
+    MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
+fi
+
+. "$MH_OBJ_DIR/test/common.sh"
+
+setup_test
+
+LC_ALL=en_US.UTF-8; export LC_ALL
+
+draft="$MH_TEST_DIR/$$.draft"
+expected="$MH_TEST_DIR/$$.expected"
+
+#
+# Try out a draft with some 8-bit encoded parameters
+#
+
+cat > "$draft" <<EOF
+To: Mr Test <mrtest@example.com>
+cc:
+------
+This is a test message
+#image/jpeg {attachment; filename="tïny.jpg"} ${srcdir}/test/mhbuild/tiny.jpg
+EOF
+
+run_prog mhbuild "$draft"
+
+cat > "$expected" <<EOF
+To: Mr Test <mrtest@example.com>
+cc:
+Fcc: +outbox
+MIME-Version: 1.0
+Content-Type: image/jpeg; name="tiny.jpg"
+Content-Description: tiny.jpg
+Content-Disposition: attachment; filename="tiny.jpg"
+Content-Transfer-Encoding: base64
+
+/9g=
+EOF
+
+check "$draft" "$expected"
+
+exit ${failed:-0}