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
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
78
RunTest
78
RunTest
|
@ -459,45 +459,47 @@ 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=
|
||||||
if [ $? -eq 0 ] ; then
|
|
||||||
locale=fr_FR
|
# In some environments locales that are listed by the "locale -a"
|
||||||
infile=$testdata/testinput3
|
# command do not seem to work with setlocale(). Therefore, we do
|
||||||
outfile=$testdata/testoutput3
|
# a preliminary test to see if pcre2test can set one before going
|
||||||
outfile2=$testdata/testoutput3A
|
# on to use it.
|
||||||
outfile3=$testdata/testoutput3B
|
|
||||||
else
|
for loc in 'fr_FR' 'french' 'fr' 'fr_CA'; do
|
||||||
infile=test3input
|
locale -a | grep "^$loc\$" >/dev/null
|
||||||
outfile=test3output
|
|
||||||
outfile2=test3outputA
|
|
||||||
outfile3=test3outputB
|
|
||||||
locale -a | grep '^french$' >/dev/null
|
|
||||||
if [ $? -eq 0 ] ; then
|
if [ $? -eq 0 ] ; then
|
||||||
locale=french
|
echo "/a/locale=$loc" | \
|
||||||
sed 's/fr_FR/french/' $testdata/testinput3 >test3input
|
$sim $valgrind ./pcre2test -q $bmode | \
|
||||||
sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
|
grep "Failed to set locale" >/dev/null
|
||||||
sed 's/fr_FR/french/' $testdata/testoutput3A >test3outputA
|
if [ $? -ne 0 ] ; then
|
||||||
sed 's/fr_FR/french/' $testdata/testoutput3B >test3outputB
|
locale=$loc
|
||||||
else
|
if [ "$locale" = "fr_FR" ] ; then
|
||||||
locale -a | grep '^fr$' >/dev/null
|
infile=$testdata/testinput3
|
||||||
if [ $? -eq 0 ] ; then
|
outfile=$testdata/testoutput3
|
||||||
locale=fr
|
outfile2=$testdata/testoutput3A
|
||||||
sed 's/fr_FR/fr/' $testdata/intestinput3 >test3input
|
outfile3=$testdata/testoutput3B
|
||||||
sed 's/fr_FR/fr/' $testdata/intestoutput3 >test3output
|
else
|
||||||
sed 's/fr_FR/fr/' $testdata/intestoutput3A >test3outputA
|
infile=test3input
|
||||||
sed 's/fr_FR/fr/' $testdata/intestoutput3B >test3outputB
|
outfile=test3output
|
||||||
else
|
outfile2=test3outputA
|
||||||
locale=
|
outfile3=test3outputB
|
||||||
fi
|
sed "s/fr_FR/$loc/" $testdata/testinput3 >test3input
|
||||||
|
sed "s/fr_FR/$loc/" $testdata/testoutput3 >test3output
|
||||||
|
sed "s/fr_FR/$loc/" $testdata/testoutput3A >test3outputA
|
||||||
|
sed "s/fr_FR/$loc/" $testdata/testoutput3B >test3outputB
|
||||||
|
fi
|
||||||
|
break
|
||||||
|
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