summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2012-01-18 11:26:24 -0700
committerKarl Williamson <public@khwilliamson.com>2012-01-21 10:02:55 -0700
commite439cacbc5a93fb9e6c524e31ac41772af51dfa0 (patch)
treea2150c3ff460901749badbfb9c8552e334422e3e /lib
parentd9aa4013885b1910c2ee50bc3a434785bcf91cbb (diff)
downloadperl-e439cacbc5a93fb9e6c524e31ac41772af51dfa0.tar.gz
locale.t: Don't bother testing locales with malformed names
Instead, just fail those.
Diffstat (limited to 'lib')
-rw-r--r--lib/locale.t27
1 files changed, 14 insertions, 13 deletions
diff --git a/lib/locale.t b/lib/locale.t
index 29ce2bb436..81be59ea60 100644
--- a/lib/locale.t
+++ b/lib/locale.t
@@ -340,9 +340,20 @@ my @Alnum_;
sub trylocale {
my $locale = shift;
return if grep { $locale eq $_ } @Locale;
- if (setlocale(LC_ALL, $locale)) {
- push @Locale, $locale;
+ return unless setlocale(LC_ALL, $locale);
+ my $badutf8;
+ {
+ local $SIG{__WARN__} = sub {
+ $badutf8 = $_[0] =~ /Malformed UTF-8/;
+ };
+ $Locale =~ /UTF-?8/i;
+ }
+
+ if ($badutf8) {
+ ok(0, "Locale name contains malformed utf8");
+ return;
}
+ push @Locale, $locale;
}
sub decode_encodings {
@@ -570,19 +581,9 @@ foreach $Locale (@Locale) {
my $word = join('', @Neoalpha);
- my $badutf8;
- {
- local $SIG{__WARN__} = sub {
- $badutf8 = $_[0] =~ /Malformed UTF-8/;
- };
- $Locale =~ /utf-?8/i;
- }
-
++$locales_test_number;
$test_names{$locales_test_number} = 'Verify that alnums outside the C locale match \w';
- if ($badutf8) {
- debug "# Locale name contains bad UTF-8, skipping test $locales_test_number for locale '$Locale'\n";
- } elsif ($Locale =~ /utf-?8/i) {
+ if ($Locale =~ /utf-?8/i) {
push @{$Okay{$locales_test_number}}, $Locale;
debug "# unknown whether locale and Unicode have the same \\w, skipping test $locales_test_number for locale '$Locale'\n";
} else {