From: David Levine Date: Sat, 14 Jun 2014 16:52:42 +0000 (-0500) Subject: Skip (parts of) tests that require en_US.utf8 locale if it's X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/0d3875d020fb17d34918f5e81ee7f87fbc5d1565?hp=c9366c80d5a32921fe60a1fb5ba86ce3e88e292d Skip (parts of) tests that require en_US.utf8 locale if it's not available. Thanks to Alexander Zangerl for reporting the issue. --- diff --git a/test/common.sh.in b/test/common.sh.in index a0088087..f4225e1b 100644 --- a/test/common.sh.in +++ b/test/common.sh.in @@ -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 () diff --git a/test/dist/test-dist b/test/dist/test-dist index c082b5e3..6c3c80b5 100755 --- a/test/dist/test-dist +++ b/test/dist/test-dist @@ -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" </dev/null; then can_reformat_texthtml=1 diff --git a/test/mhlist/test-ext-params b/test/mhlist/test-ext-params index 409a4eda..2e2373e5 100755 --- a/test/mhlist/test-ext-params +++ b/test/mhlist/test-ext-params @@ -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 diff --git a/test/mhshow/test-charset b/test/mhshow/test-charset index c41e5127..39f52a67 100755 --- a/test/mhshow/test-charset +++ b/test/mhshow/test-charset @@ -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 diff --git a/test/mhshow/test-textcharset b/test/mhshow/test-textcharset index a66db46f..f21ea56f 100755 --- a/test/mhshow/test-textcharset +++ b/test/mhshow/test-textcharset @@ -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 diff --git a/test/pick/test-pick b/test/pick/test-pick index ea00b815..7c3896ea 100755 --- a/test/pick/test-pick +++ b/test/pick/test-pick @@ -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 diff --git a/test/scan/test-scan-multibyte b/test/scan/test-scan-multibyte index fb9747d6..9dae456e 100755 --- a/test/scan/test-scan-multibyte +++ b/test/scan/test-scan-multibyte @@ -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 #