summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2015-03-08 22:26:17 -0600
committerKarl Williamson <khw@cpan.org>2015-03-09 09:37:08 -0600
commitef9d5242d3ebebaa273eaaaf24138e38db8939b2 (patch)
tree75c42b6e338515ade395c906d99104656cab779c /lib
parent128e4113466e835078eb016709e5d23b86be3120 (diff)
downloadperl-ef9d5242d3ebebaa273eaaaf24138e38db8939b2.tar.gz
Skip various locale tests when locales are not available
It is possible to compile Perl without locales, and some platforms may not have them available properly. These tests were failing under these conditions. This commit uses the new infrastructure in loc_tools.pl to centralize the knowledge of how to determine if locales are available.
Diffstat (limited to 'lib')
-rw-r--r--lib/locale.pm2
-rw-r--r--lib/locale.t12
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/locale.pm b/lib/locale.pm
index 61e77c7f7a..9cc243f86c 100644
--- a/lib/locale.pm
+++ b/lib/locale.pm
@@ -1,6 +1,6 @@
package locale;
-our $VERSION = '1.05';
+our $VERSION = '1.06';
use Config;
$Carp::Internal{ (__PACKAGE__) } = 1;
diff --git a/lib/locale.t b/lib/locale.t
index 5012d3b956..9238290545 100644
--- a/lib/locale.t
+++ b/lib/locale.t
@@ -19,13 +19,13 @@ BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
unshift @INC, '.';
- require Config; import Config;
- if (!$Config{d_setlocale} || $Config{ccflags} =~ /\bD?NO_LOCALE\b/) {
+ require './loc_tools.pl';
+ unless (locales_enabled('LC_CTYPE')) {
print "1..0\n";
exit;
}
- require './loc_tools.pl';
$| = 1;
+ require Config; import Config;
}
use strict;
@@ -1856,7 +1856,9 @@ foreach my $Locale (@Locale) {
# first). This is only done if the current locale has LC_MESSAGES
$ok14 = 1;
$ok14_5 = 1;
- if (setlocale(&POSIX::LC_MESSAGES, $Locale)) {
+ if ( locales_enabled('LC_MESSAGES')
+ && setlocale(&POSIX::LC_MESSAGES, $Locale))
+ {
foreach my $err (keys %!) {
use Errno;
$! = eval "&Errno::$err"; # Convert to strerror() output
@@ -1904,6 +1906,7 @@ foreach my $Locale (@Locale) {
}
$ok21 = 1;
+ if (locales_enabled('LC_MESSAGES')) {
foreach my $err (keys %!) {
no locale;
use Errno;
@@ -1912,6 +1915,7 @@ foreach my $Locale (@Locale) {
if ("$strerror" =~ /\P{ASCII}/) {
$ok21 = 0;
last;
+ }
}
}