]> diplodocus.org Git - nmh/commitdiff
Test to make sure mhshow is actually invoking a charset conversion
authorKen Hornstein <kenh@pobox.com>
Mon, 28 Oct 2013 18:44:30 +0000 (14:44 -0400)
committerKen Hornstein <kenh@pobox.com>
Mon, 28 Oct 2013 18:44:30 +0000 (14:44 -0400)
program if one is defined.

Makefile.am
test/mhshow/test-charset [new file with mode: 0755]

index 67423f00898e378a955cf74d2d8159d6d4c54f98..0749c07dc06562589c7c04383ce8e78635c1992f 100644 (file)
@@ -66,6 +66,7 @@ TESTS = test/ali/test-ali test/anno/test-anno \
        test/mhfixmsg/test-mhfixmsg \
        test/mhlist/test-mhlist test/mhmail/test-mhmail \
        test/mhparam/test-mhparam test/mhpath/test-mhpath \
+       test/mhshow/test-charset \
        test/mhshow/test-cte-binary test/mhshow/test-qp \
        test/mhshow/test-subpart test/mhshow/test-msg-buffer-boundaries \
        test/mhstore/test-mhstore test/new/test-basic \
diff --git a/test/mhshow/test-charset b/test/mhshow/test-charset
new file mode 100755 (executable)
index 0000000..64c9812
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/sh
+######################################################
+#
+# Test charset conversion functionality
+#
+######################################################
+
+set -e
+
+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
+
+expected=$MH_TEST_DIR/$$.expected
+actual=$MH_TEST_DIR/$$.actual
+
+echo 'mhshow-charset-windows-1252: echo "This is a test"' >> $MH_TEST_DIR/Mail/.mh_profile
+
+# Write message with bogus quoted-printable data.
+msgfile=`mhpath new`
+msgnum=`basename $msgfile`
+cat > $msgfile <<EOF
+From: foo@example.edu
+To: bar@example.edu
+Subject: test
+MIME-Version: 1.0
+Content-Type: text/plain; charset=windows-1252
+Content-Transfer-Encoding: quoted-printable
+Date: Sun, 18 Dec 2005 00:52:39 +0100
+
+4 =F7 2 =3D 2
+EOF
+
+cat > $expected <<EOF
+Date:    Sun, 18 Dec 2005 00:52:39 +0100
+To:      bar@example.edu
+From:    foo@example.edu
+Subject: test
+
+MIME-Version: 1.0
+
+part       text/plain                  10
+This is a test
+EOF
+
+mhshow -nopause $msgnum > $actual 2>&1
+check "$expected" "$actual"
+
+exit $failed