summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2016-10-29 12:24:21 -0600
committerKarl Williamson <khw@cpan.org>2016-11-28 17:15:24 -0700
commit83cf869355710e5fa99226ae9c014afdb53a30cf (patch)
tree17a7a09c1bd89c9febf420c25462959399e3e8ac /lib
parent983d792ccf473faca5827d9cddb06a1a59e5dc6d (diff)
downloadperl-83cf869355710e5fa99226ae9c014afdb53a30cf.tar.gz
lib/locale.t: Improve skipping of incompatible locales
Perl works properly with only a subset of the possible locales out there. This improves the detection of those and the skipping.
Diffstat (limited to 'lib')
-rw-r--r--lib/locale.t11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/locale.t b/lib/locale.t
index 4a2cb75234..9695d86980 100644
--- a/lib/locale.t
+++ b/lib/locale.t
@@ -750,8 +750,9 @@ debug "Scanning for locales...\n";
require POSIX; import POSIX ':locale_h';
-my @Locale = find_locales([ 'LC_CTYPE', 'LC_NUMERIC', 'LC_ALL' ]);
-my @include_incompatible_locales = find_locales('LC_CTYPE',
+my $categories = [ 'LC_CTYPE', 'LC_NUMERIC', 'LC_ALL' ];
+my @Locale = find_locales($categories);
+my @include_incompatible_locales = find_locales($categories,
'even incompatible locales');
# The locales included in the incompatible list that aren't in the compatible
@@ -778,12 +779,16 @@ if (@Locale < @include_incompatible_locales) {
push @warnings, ($warning =~ s/\n/\n# /sgr);
};
- setlocale(&POSIX::LC_CTYPE, $bad_locale);
+ my $ret = setlocale(&POSIX::LC_CTYPE, $bad_locale);
my $message = "testing of locale '$bad_locale' is skipped";
if (@warnings) {
skip $message . ":\n# " . join "\n# ", @warnings;
}
+ elsif (! $ret) {
+ skip("$message:\n#"
+ . " setlocale(&POSIX::LC_CTYPE, '$bad_locale') failed");
+ }
else {
fail $message . ", because it is was found to be incompatible with"
. " Perl, but could not discern reason";