On 02/08/2013 03:47 PM, Bernhard Voelker wrote:
On February 8, 2013 at 4:13 PM Assaf Gordon <[email protected]> wrote:
Regarding the 'numfmt' failures - these are locale-related problems (in both
cases).
Perhaps I wrote the tests incorrectly.
May I ask you to try the followings on those systems, and send the output (or
compare with this expected output):
# The french locale is used for locale testing - if it doesn't exist,
those tests should not run at all.
$ locale -a | grep -i fr
fr_FR.utf8
Sure:
$ locale -a | grep -i fr
br_FR
br_FR@euro
br_FR.utf8
fr_BE
fr_BE@euro
fr_BE.utf8
fr_CA
fr_CA.utf8
fr_CH
fr_CH.utf8
fr_FR
fr_FR@euro
fr_FR.utf8
fr_LU
fr_LU@euro
fr_LU.utf8
oc_FR
oc_FR.utf8
# First try without locale (this is test 'lcl-grp-1' which succeeded)
$ LC_ALL=C ./src/numfmt --debug --grouping --from=si 7M
./src/numfmt: grouping has no effect in this locale
7000000
LC_ALL=C ./src/numfmt --debug --grouping --from=si 7M
./src/numfmt: grouping has no effect in this locale
7000000
# Try grouping, the expected output should have a space as
thousands-separator
# this is test lcl-grp-3 which failed, on your system the result was
"7000000"
$ LC_ALL=fr_FR.utf8 ./src/numfmt --debug --grouping --from=si 7M
7 000 000
LC_ALL=fr_FR.utf8 ./src/numfmt --debug --grouping --from=si 7M
./src/numfmt: grouping has no effect in this locale
7000000
Have a nice day,
Berny
OK so we can't assume the locale will behave as we want.
Therefore we can gate the test on the output of the independent
printf like:
diff --git a/tests/misc/numfmt.pl b/tests/misc/numfmt.pl
index c542483..603b60a 100644
--- a/tests/misc/numfmt.pl
+++ b/tests/misc/numfmt.pl
@@ -883,7 +883,19 @@ my @Locale_Tests =
{ENV=>"LC_ALL=$locale"}],
);
-push @Tests, @Locale_Tests if $locale ne "C";
+if ($locale ne 'C')
+ {
+ # Reset locale to 'C' if LOCALE_FR_UTF8 doesn't output as expected
+ # as determined by the separate printf program.
+ my $loc_num = `LC_ALL=$locale printf "%'d\n" 1234`;
+ chomp($loc_num);
+ if ($loc_num ne '1 234')
+ {
+ warn "loc_num =$loc_num=\n";
+ $locale = 'C';
+ }
+ }
+push @Tests, @Locale_Tests if $locale ne 'C';
## Check all valid/invalid suffixes
foreach my $suf ( 'A' .. 'Z', 'a' .. 'z' ) {
cheers,
Pádraig.