]> diplodocus.org Git - nmh/commitdiff
Changed test suite's require_locale() to set the locale that it
authorDavid Levine <levinedl@acm.org>
Mon, 10 Oct 2016 13:54:51 +0000 (09:54 -0400)
committerDavid Levine <levinedl@acm.org>
Mon, 10 Oct 2016 13:54:51 +0000 (09:54 -0400)
finds, and added upper case versions of locale names to each test.
This should allow the tests to succeed on old Solaris.

18 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/mhical/test-mhical
test/mhl/test-rfc6532
test/mhlist/test-ext-params
test/mhshow/test-charset
test/mhshow/test-textcharset
test/pick/test-pick
test/post/test-rfc6531
test/repl/test-convert
test/scan/test-local-mailbox [new file with mode: 0755]
test/scan/test-scan-multibyte

index 47df61e..b123aca 100644 (file)
@@ -110,10 +110,15 @@ require_prog ()
 }
 
 # Skip test if none of the offered locales are supported.
+# As side effect, use the first locale that is found.  Note that
+# some platforms allow, by way of example, en_US.UTF-8 to be used
+# even though en_US.UTF8 is listed by locale -a.  But by setting
+# LC_ALL here, we don't rely on that.
 require_locale ()
 {
   for locale in "$@"; do
     if locale -a | grep -i "$locale" >/dev/null; then
+        LC_ALL="$locale"; export LC_ALL
         return
     fi
   done
index dc27ae8..fa00b4b 100755 (executable)
@@ -389,8 +389,7 @@ run_test 'scan +outbox -width 6 2' '   2  '
 # Check that dist encodes headers using RFC-2047 properly
 #
 
-require_locale en_US.utf-8 en_US.utf8
-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
 
 cat >"$expected" <<EOF
 From: Test1 <test1@example.com>
index 3b285ef..c97ec39 100755 (executable)
@@ -14,8 +14,7 @@ fi
 
 setup_test
 
-require_locale en_US.utf-8 en_US.utf8
-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"
index 4d7c6d9..e4a8fbf 100755 (executable)
@@ -16,8 +16,7 @@ setup_test
 
 set -e
 
-require_locale en_US.utf-8 en_US.utf8
-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"
index 039fe9a..5be4514 100755 (executable)
@@ -14,8 +14,7 @@ fi
 
 setup_test
 
-require_locale en_US.utf-8 en_US.utf8
-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"
index e96783f..6459bf2 100755 (executable)
@@ -21,8 +21,7 @@ backupname="${MH_TEST_DIR}/`mhparam sbackup`$$"
 #
 # We're going to hardcode UTF-8 for this test.
 #
-require_locale en_US.utf-8 en_US.utf8
-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
 
 #
 # Basic test of encoding a short subject
index cb5aa95..22de535 100755 (executable)
@@ -19,8 +19,7 @@ testname="${MH_TEST_DIR}/$$"
 expected="$MH_TEST_DIR/$$.expected"
 actual="$MH_TEST_DIR/$$.actual"
 
-require_locale en_US.utf-8 en_US.utf8
-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
 
 #### Rely on sendmail/pipe below to override default mts.
 mts_fakesendmail="${MHMTSCONF}-fakesendmail"
index 167c237..8d7a3a8 100755 (executable)
@@ -17,8 +17,7 @@ fi
 setup_test
 
 #### Make sure that html-to-text conversion is what we expect.
-require_locale en_US.utf-8 en_US.utf8
-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
 
 expected="$MH_TEST_DIR/test-mhfixmsg$$.expected"
 expected_err="$MH_TEST_DIR/test-mhfixmsg$$.expected_err"
index 533270e..c8b0920 100755 (executable)
@@ -17,8 +17,7 @@ fi
 setup_test
 
 #### Make sure that html-to-text conversion is what we expect.
-require_locale en_US.utf-8 en_US.utf8
-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
 
 #### Disable colorized output.
 TERM=dumb; export TERM
index 96ee873..978f291 100755 (executable)
@@ -19,8 +19,7 @@ setup_test
 mhl="${MH_LIBEXEC_DIR}/mhl"
 
 #### Make sure that html-to-text conversion is what we expect.
-require_locale en_US.utf-8 en_US.utf8
-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
 
 
 # check UTF-8 headers
index 73dcf88..fb64d41 100755 (executable)
@@ -16,8 +16,7 @@ fi
 
 setup_test
 
-require_locale en_US.utf-8 en_US.utf8
-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
 
 expected=$MH_TEST_DIR/$$.expected
 actual=$MH_TEST_DIR/$$.actual
index 6c3c763..9039764 100755 (executable)
@@ -16,8 +16,7 @@ fi
 
 setup_test
 
-require_locale en_US.utf-8 en_US.utf8
-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
 
 test "$ICONV_ENABLED" -eq 0  &&  text_size=10  || text_size=11
 
index f8d854f..8bba169 100755 (executable)
@@ -20,8 +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.utf-8 en_US.utf8
-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
 
 expected="$MH_TEST_DIR"/$$.expected
 actual="$MH_TEST_DIR"/$$.actual
index ca19bb8..6ec67d9 100755 (executable)
@@ -267,9 +267,9 @@ echo 13 >"$expected"
 
 set +e
 
-require_locale en_US.utf-8 en_US.utf8
+require_locale en_US.UTF-8 en_US.UTF8 en_US.utf-8 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
+pick -subject foobar 13 >"$actual" 2>&1
 set -e
 check "$expected" "$actual"
 
index 135d6f2..89c6e36 100755 (executable)
@@ -19,8 +19,7 @@ mhl="${MH_LIBEXEC_DIR}/mhl"
 SMTPUTF8=1; export SMTPUTF8
 
 #### Make sure that html-to-text conversion is what we expect.
-require_locale en_US.utf-8 en_US.utf8
-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
 
 #### Enable EAI in mhbuild, via the profile.
 sed "s%^\(mhbuild: .*\)%\1 -headerencoding utf-8%" "$MH" >"$MH.new"
index f7c15dc..dd7c101 100755 (executable)
@@ -76,8 +76,7 @@ check "$actual" "$expected"
 
 #### Make sure that this works with 8-bit encoding.
 finish_test
-require_locale en_US.utf-8 en_US.utf8
-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
 
 
 # check -convertarg with multiple parts, 7 bit
diff --git a/test/scan/test-local-mailbox b/test/scan/test-local-mailbox
new file mode 100755 (executable)
index 0000000..0fbc89a
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+######################################################
+#
+# Test scan with Local-Mailbox set.
+#
+######################################################
+
+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
+
+# est1@example.com is a substring of test1@example.com; the latter
+# should not be considered a match for the former (causing 'To:Some
+# User' to be printed instead of 'Test1').
+echo 'Local-Mailbox: est1@example.com' >> "$MH"
+
+expected="$MH_TEST_DIR/$$.expected"
+actual="$MH_TEST_DIR/$$.actual"
+
+cat >"$expected" <<EOF
+   1  09/29 Test1              Testing message 1<<This is message number 1 >>
+   2  09/29 Test2              Testing message 2<<This is message number 2 >>
+   3  09/29 Test3              Testing message 3<<This is message number 3 >>
+   4  09/29 Test4              Testing message 4<<This is message number 4 >>
+   5  09/29 Test5              Testing message 5<<This is message number 5 >>
+   6  09/29 Test6              Testing message 6<<This is message number 6 >>
+   7  09/29 Test7              Testing message 7<<This is message number 7 >>
+   8  09/29 Test8              Testing message 8<<This is message number 8 >>
+   9  09/29 Test9              Testing message 9<<This is message number 9 >>
+  10  09/29 Test10             Testing message 10<<This is message number 10 >>
+EOF
+
+run_prog scan +inbox -width 80 >"$actual" || exit 1
+check "$expected" "$actual"
+
+exit $failed
index 3ce5df7..bab76b6 100755 (executable)
@@ -26,8 +26,7 @@ if test "${MULTIBYTE_ENABLED}" -ne 1; then
     test_skip "configure did not detect multibyte support"
 fi
 
-require_locale en_US.utf-8 en_US.utf8
-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
 
 #
 # Create a test message with RFC 2047 headers we can scan