]> diplodocus.org Git - nmh/commitdiff
Skip (parts of) tests that require en_US.utf8 locale if it's
authorDavid Levine <levinedl@acm.org>
Sat, 14 Jun 2014 16:52:42 +0000 (11:52 -0500)
committerDavid Levine <levinedl@acm.org>
Sat, 14 Jun 2014 16:52:42 +0000 (11:52 -0500)
not available.  Thanks to Alexander Zangerl for reporting the
issue.

13 files changed:
test/common.sh.in
test/dist/test-dist
test/mhbuild/test-attach
test/mhbuild/test-cte
test/mhbuild/test-ext-params
test/mhbuild/test-header-encode
test/mhbuild/test-utf8-body
test/mhfixmsg/test-mhfixmsg
test/mhlist/test-ext-params
test/mhshow/test-charset
test/mhshow/test-textcharset
test/pick/test-pick
test/scan/test-scan-multibyte

index a008808..f4225e1 100644 (file)
@@ -85,6 +85,18 @@ require_prog ()
   fi
 }
 
+# Skip test if none of the offered locales are supported.
+require_locale ()
+{
+  for locale in "$@"; do
+    if locale -a | grep -i "$locale" >/dev/null; then
+        return
+    fi
+  done
+
+  test_skip "no suitable locale available"
+}
+
 # Some stuff for doing silly progress indicators
 if [ -t 1 ] ; then
   progress_update ()
index c082b5e..6c3c80b 100755 (executable)
@@ -388,6 +388,7 @@ run_test 'scan +outbox -width 6 2' '   2 '
 # Check that dist encodes headers using RFC-2047 properly
 #
 
+require_locale en_US.utf8
 LC_ALL=en_US.UTF-8; export LC_ALL
 
 cat >"$expected" <<EOF
index f51d2bc..8e2edf8 100755 (executable)
@@ -14,6 +14,7 @@ fi
 
 setup_test
 
+require_locale en_US.utf8
 LC_ALL=en_US.UTF-8; export LC_ALL
 
 draft="$MH_TEST_DIR/$$.draft"
index f996e73..b63f199 100755 (executable)
@@ -16,6 +16,7 @@ setup_test
 
 set -e
 
+require_locale en_US.utf8
 LC_ALL=en_US.UTF-8; export LC_ALL
 
 draft="$MH_TEST_DIR/$$.draft"
index 0b5e66d..4e28ab4 100755 (executable)
@@ -14,6 +14,7 @@ fi
 
 setup_test
 
+require_locale en_US.utf8
 LC_ALL=en_US.UTF-8; export LC_ALL
 
 draft="$MH_TEST_DIR/$$.draft"
index e4883b5..7cc25be 100755 (executable)
@@ -21,7 +21,7 @@ backupname="${MH_TEST_DIR}/`mhparam sbackup`$$"
 #
 # We're going to hardcode UTF-8 for this test.
 #
-
+require_locale en_US.utf8
 LC_ALL=en_US.UTF-8; export LC_ALL
 
 #
index 1362970..377d623 100755 (executable)
@@ -19,6 +19,7 @@ testname="${MH_TEST_DIR}/$$"
 expected="$MH_TEST_DIR/$$.expected"
 actual="$MH_TEST_DIR/$$.actual"
 
+require_locale en_US.utf8
 LC_ALL=en_US.UTF-8; export LC_ALL
 
 #### Rely on sendmail/pipe below to override default mts.
index d60b9d7..dea2ddc 100755 (executable)
@@ -14,14 +14,15 @@ fi
 
 . "${srcdir}/test/post/test-post-common.sh"
 
+#### Make sure that html-to-text conversion is what we expect.
+require_locale en_US.utf8
+LC_ALL=en_US.UTF-8; export LC_ALL
+
 expected="$MH_TEST_DIR/test-mhfixmsg$$.expected"
 expected_err="$MH_TEST_DIR/test-mhfixmsg$$.expected_err"
 actual="$MH_TEST_DIR/test-mhfixmsg$$.actual"
 actual_err="$MH_TEST_DIR/test-mhfixmsg$$.actual_err"
 
-#### Make sure that html-to-text conversion is what we expect.
-LC_ALL=en_US.UTF-8; export LC_ALL
-
 if grep mhfixmsg-format-text/html "${MH_TEST_DIR}/Mail/mhn.defaults" \
   >/dev/null; then
   can_reformat_texthtml=1
index 409a4ed..2e2373e 100755 (executable)
@@ -16,9 +16,11 @@ fi
 
 setup_test
 
+require_locale en_US.utf8
+LC_ALL=en_US.UTF-8; export LC_ALL
+
 expected=$MH_TEST_DIR/$$.expected
 actual=$MH_TEST_DIR/$$.actual
-LC_ALL=en_US.UTF-8; export LC_ALL
 
 #
 # Write a message with some extended parameters
index c41e512..39f52a6 100755 (executable)
@@ -16,6 +16,7 @@ fi
 
 setup_test
 
+require_locale en_US.utf8
 LC_ALL=en_US.UTF-8; export LC_ALL
 
 test "$ICONV_ENABLED" -eq 0  &&  text_size=10  || text_size=11
index a66db46..f21ea56 100755 (executable)
@@ -20,6 +20,7 @@ if test "$ICONV_ENABLED" -eq 0; then
   test_skip 'test-textcharset requires that nmh have been built with iconv'
 fi
 
+require_locale en_US.utf8
 LC_ALL=en_US.UTF-8; export LC_ALL
 
 expected="$MH_TEST_DIR"/$$.expected
index ea00b81..7c3896e 100755 (executable)
@@ -262,6 +262,7 @@ echo 13 >"$expected"
 
 set +e
 
+require_locale en_US.utf8
 # Don't use run_prog here because it loses the environment setting.
 LC_ALL=en_US.UTF-8 pick -subject foobar 13 >"$actual" 2>&1
 set -e
index fb9747d..9dae456 100755 (executable)
@@ -26,6 +26,7 @@ if test "${MULTIBYTE_ENABLED}" -ne 1; then
     test_skip "configure did not detect multibyte support"
 fi
 
+require_locale en_US.utf8
 LC_ALL=en_US.UTF-8; export LC_ALL
 
 #