Update RunTest to handle locales better.
This commit is contained in:
parent
9059444834
commit
3e253d04de
|
@ -65,6 +65,13 @@ undefined outcome.
|
||||||
12. A UTF pattern containing a "not" match of a non-ASCII character and a
|
12. A UTF pattern containing a "not" match of a non-ASCII character and a
|
||||||
subroutine reference could loop at compile time. Example: /[^\xff]((?1))/.
|
subroutine reference could loop at compile time. Example: /[^\xff]((?1))/.
|
||||||
|
|
||||||
|
13. The locale test (RunTest 3) has been upgraded. It now checks that a locale
|
||||||
|
that is found in the output of "locale -a" can actually be set by pcre2test
|
||||||
|
before it is accepted. Previously, in an environment where a locale was listed
|
||||||
|
but would not set (an example does exist), the test would "pass" without
|
||||||
|
actually doing anything. Also the fr_CA locale has been added to the list of
|
||||||
|
locales that can be used.
|
||||||
|
|
||||||
|
|
||||||
Version 10.00 05-January-2015
|
Version 10.00 05-January-2015
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
58
RunTest
58
RunTest
|
@ -459,16 +459,29 @@ for bmode in "$test8" "$test16" "$test32"; do
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Locale-specific tests, provided that either the "fr_FR" or the "french"
|
# Locale-specific tests, provided that either the "fr_FR", "fr_CA", "french"
|
||||||
# locale is available. The former is the Unix-like standard; the latter is
|
# or "fr" locale is available. The first two are Unix-like standards; the
|
||||||
# for Windows. Another possibility is "fr". Unfortunately, different versions
|
# last two are for Windows. Unfortunately, different versions of the French
|
||||||
# of the French locale give different outputs for some items. This test passes
|
# locale give different outputs for some items. This test passes if the
|
||||||
# if the output matches any one of the alternative output files.
|
# output matches any one of the alternative output files.
|
||||||
|
|
||||||
if [ $do3 = yes ] ; then
|
if [ $do3 = yes ] ; then
|
||||||
locale -a | grep '^fr_FR$' >/dev/null
|
locale=
|
||||||
|
|
||||||
|
# In some environments locales that are listed by the "locale -a"
|
||||||
|
# command do not seem to work with setlocale(). Therefore, we do
|
||||||
|
# a preliminary test to see if pcre2test can set one before going
|
||||||
|
# on to use it.
|
||||||
|
|
||||||
|
for loc in 'fr_FR' 'french' 'fr' 'fr_CA'; do
|
||||||
|
locale -a | grep "^$loc\$" >/dev/null
|
||||||
if [ $? -eq 0 ] ; then
|
if [ $? -eq 0 ] ; then
|
||||||
locale=fr_FR
|
echo "/a/locale=$loc" | \
|
||||||
|
$sim $valgrind ./pcre2test -q $bmode | \
|
||||||
|
grep "Failed to set locale" >/dev/null
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
locale=$loc
|
||||||
|
if [ "$locale" = "fr_FR" ] ; then
|
||||||
infile=$testdata/testinput3
|
infile=$testdata/testinput3
|
||||||
outfile=$testdata/testoutput3
|
outfile=$testdata/testoutput3
|
||||||
outfile2=$testdata/testoutput3A
|
outfile2=$testdata/testoutput3A
|
||||||
|
@ -478,26 +491,15 @@ for bmode in "$test8" "$test16" "$test32"; do
|
||||||
outfile=test3output
|
outfile=test3output
|
||||||
outfile2=test3outputA
|
outfile2=test3outputA
|
||||||
outfile3=test3outputB
|
outfile3=test3outputB
|
||||||
locale -a | grep '^french$' >/dev/null
|
sed "s/fr_FR/$loc/" $testdata/testinput3 >test3input
|
||||||
if [ $? -eq 0 ] ; then
|
sed "s/fr_FR/$loc/" $testdata/testoutput3 >test3output
|
||||||
locale=french
|
sed "s/fr_FR/$loc/" $testdata/testoutput3A >test3outputA
|
||||||
sed 's/fr_FR/french/' $testdata/testinput3 >test3input
|
sed "s/fr_FR/$loc/" $testdata/testoutput3B >test3outputB
|
||||||
sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
|
fi
|
||||||
sed 's/fr_FR/french/' $testdata/testoutput3A >test3outputA
|
break
|
||||||
sed 's/fr_FR/french/' $testdata/testoutput3B >test3outputB
|
|
||||||
else
|
|
||||||
locale -a | grep '^fr$' >/dev/null
|
|
||||||
if [ $? -eq 0 ] ; then
|
|
||||||
locale=fr
|
|
||||||
sed 's/fr_FR/fr/' $testdata/intestinput3 >test3input
|
|
||||||
sed 's/fr_FR/fr/' $testdata/intestoutput3 >test3output
|
|
||||||
sed 's/fr_FR/fr/' $testdata/intestoutput3A >test3outputA
|
|
||||||
sed 's/fr_FR/fr/' $testdata/intestoutput3B >test3outputB
|
|
||||||
else
|
|
||||||
locale=
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
if [ "$locale" != "" ] ; then
|
if [ "$locale" != "" ] ; then
|
||||||
echo $title3 "(using '$locale' locale)"
|
echo $title3 "(using '$locale' locale)"
|
||||||
|
@ -524,9 +526,9 @@ for bmode in "$test8" "$test16" "$test32"; do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo "Cannot test locale-specific features - none of the 'fr_FR', 'fr' or"
|
echo "Cannot test locale-specific features - none of the 'fr_FR', 'fr_CA',"
|
||||||
echo "'french' locales exist, or the \"locale\" command is not available"
|
echo "'fr' or 'french' locales can be set, or the \"locale\" command is"
|
||||||
echo "to check for them."
|
echo "not available to check for them."
|
||||||
echo " "
|
echo " "
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue