From 2c2b1440b3f871605cf7afe9f9bde4f68b26f6db Mon Sep 17 00:00:00 2001 From: Dianne Skoll Date: Tue, 27 Sep 2022 21:49:33 -0400 Subject: [PATCH] Make tests work in non-utf-8 locale. --- tests/test-rem | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/test-rem b/tests/test-rem index 5a7f3ddb..24a42fac 100644 --- a/tests/test-rem +++ b/tests/test-rem @@ -26,6 +26,25 @@ if test `id -u` = 0 ; then exit 1 fi +# If we're already in a utf-8 locale, do +# nothing; otherwise, set LC_ALL +OK=0 +if echo $LC_ALL | grep -i utf-8 > /dev/null 2>&1 ; then + OK=1 +fi + +if test -z "$LC_ALL" ; then + if echo $LANG | grep -i utf-8 > /dev/null 2>&1 ; then + export LC_ALL="$LANG" + OK=1 + fi +fi + +if test "$OK" = 0 ; then + export LC_ALL=C.UTF-8 + export LANG=C.UTF-8 +fi + chmod 000 include_dir/04cantread.rem TEST_GETENV="foo bar baz" ; export TEST_GETENV echo "Test 1" > ../tests/test.out @@ -344,25 +363,6 @@ rem 24 SPECIAL COLOR 200 200 0 BRIGHT YELLOW rem 25 SPECIAL COLOR 200 200 200 BRIGHT WHITE EOF -# If we're already in a utf-8 locale, do -# nothing; otherwise, set LC_ALL -OK=0 -if echo $LC_ALL | grep -i utf-8 > /dev/null 2>&1 ; then - OK=1 -fi - -if test -z "$LC_ALL" ; then - if echo $LANG | grep -i utf-8 > /dev/null 2>&1 ; then - export LC_ALL="$LANG" - OK=1 - fi -fi - -if test "$OK" = 0 ; then - export LC_ALL=C.UTF-8 - export LANG=C.UTF-8 -fi - ../src/remind -w128 -c ../tests/utf-8.rem 1 Nov 2019 >> ../tests/test.out ../src/remind -c ../tests/test-addomit.rem 1 Sep 2021 >> ../tests/test.out