]> diplodocus.org Git - nmh/blobdiff - test/mhbuild/test-ext-params
Replace getcpy() with mh_xstrdup().
[nmh] / test / mhbuild / test-ext-params
index 8294677a7a7ce94b6360e3551e58ada14b7f496e..5be4514b43adee066eaaefba8e6ec72bd8ef7142 100755 (executable)
@@ -14,9 +14,10 @@ fi
 
 setup_test
 
-LC_ALL=en_US.UTF-8; export LC_ALL
+require_locale en_US.UTF-8 en_US.UTF8 en_US.utf-8 en_US.utf8
 
 draft="$MH_TEST_DIR/$$.draft"
+backup="${MH_TEST_DIR}/`mhparam sbackup`$$.draft.orig"
 expected="$MH_TEST_DIR/$$.expected"
 
 #
@@ -181,6 +182,31 @@ EOF
 
 check "$draft" "$expected"
 
+#
+# Test to make sure things fail if we try to put 8-bit characters when the
+# locale is US-ASCII
+#
+
+cat > "$draft" <<EOF
+To: Mr Test <mrtest@example.com>
+cc:
+Fcc: +outbox
+------
+This is a test message
+#image/jpeg {attachment} $MH_TEST_DIR/tïny.jpg
+EOF
+
+old_locale="$LC_ALL"
+LC_ALL=C; export LC_ALL
+
+set +e
+run_test 'eval mhbuild "$draft" 2>&1' 'mhbuild: 8-bit characters in parameter "filename", but local character set is US-ASCII'
+set -e
+
+LC_ALL="$old_locale"; export LC_ALL
+
+rm -f "$MH_TEST_DIR/tïny.jpg"
+
 #
 # Test out message/external-body decoding
 #
@@ -223,4 +249,6 @@ EOF
 
 check "$draft" "$expected"
 
+[ ${failed:=0} -eq 0 ]  &&  rm -f ${backup}
+
 exit ${failed:-0}