In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/a2917a7e6fef2fa2027199f241df86589c5a75f6?hp=9b7098c1c609d4628b5baab6f2c82660c2f29aef>
- Log ----------------------------------------------------------------- commit a2917a7e6fef2fa2027199f241df86589c5a75f6 Author: Karl Williamson <[email protected]> Date: Sun Mar 8 22:29:21 2015 -0600 lib/locale.t: White-space only Indent inside new block formed in the previous commit. M lib/locale.t commit ef9d5242d3ebebaa273eaaaf24138e38db8939b2 Author: Karl Williamson <[email protected]> Date: Sun Mar 8 22:26:17 2015 -0600 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. M ext/POSIX/t/posix.t M ext/re/t/reflags.t M lib/locale.pm M lib/locale.t M t/lib/warnings/regexec M t/lib/warnings/utf8 M t/op/quotemeta.t M t/op/taint.t M t/re/charset.t M t/re/pat.t M t/uni/fold.t commit 128e4113466e835078eb016709e5d23b86be3120 Author: Karl Williamson <[email protected]> Date: Sun Mar 8 10:39:38 2015 -0600 t/loc_tools.pl: Add fnc to see if locale category is available It is possible for Perl to run on platforms that don't have locale abilities, and it is possible to compile it to disable some or all of locale processing. This commit adds a function that for Perl code to call that knows the nuances of detecting this. M t/loc_tools.pl commit 3324502157a94e17a9d37b4fc67334197389ab00 Author: Karl Williamson <[email protected]> Date: Sun Mar 8 22:24:12 2015 -0600 perl.h: Make macro do nothing when LC_CTYPE not available Otherwise things won't compile. M perl.h commit e3bf330496b342e1b2f35bb5de8f2f619b42f9aa Author: Karl Williamson <[email protected]> Date: Sun Mar 8 21:16:16 2015 -0600 ext/POSIX/POSIX.xs: Convert do whiles into whiles I don't know why these are do { ] while's, but with the correct combination of compile flags (such as -DNO_LOCALE), and/or perhaps platform, one or the other could be called the first time with nulls, so they need to be straight while{}s to avoid segfaults. M ext/POSIX/POSIX.xs M ext/POSIX/lib/POSIX.pm ----------------------------------------------------------------------- Summary of changes: ext/POSIX/POSIX.xs | 12 +++++---- ext/POSIX/lib/POSIX.pm | 2 +- ext/POSIX/t/posix.t | 4 ++- ext/re/t/reflags.t | 8 ++---- lib/locale.pm | 2 +- lib/locale.t | 28 +++++++++++--------- perl.h | 16 +++++++----- t/lib/warnings/regexec | 20 ++++++++------ t/lib/warnings/utf8 | 30 +++++++++++++-------- t/loc_tools.pl | 71 +++++++++++++++++++++++++++++++++++++++++++++----- t/op/quotemeta.t | 5 ++-- t/op/taint.t | 15 ++++++----- t/re/charset.t | 2 +- t/re/pat.t | 10 +++---- t/uni/fold.t | 2 +- 15 files changed, 153 insertions(+), 74 deletions(-) diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index b1118bd..26ca464 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -2011,7 +2011,7 @@ localeconv() const struct lconv_offset *integers = lconv_integers; const char *ptr = (const char *) lcbuf; - do { + while (strings->name) { /* This string may be controlled by either LC_NUMERIC, or * LC_MONETARY */ bool is_utf8_locale @@ -2042,16 +2042,18 @@ localeconv() && ! is_invariant_string((U8 *) value, 0) && is_utf8_string((U8 *) value, 0)), 0); - } - } while ((++strings)->name); + } + strings++; + } - do { + while (integers->name) { const char value = *((const char *)(ptr + integers->offset)); if (value != CHAR_MAX) (void) hv_store(RETVAL, integers->name, strlen(integers->name), newSViv(value), 0); - } while ((++integers)->name); + integers++; + } } RESTORE_NUMERIC_STANDARD(); #endif /* HAS_LOCALECONV */ diff --git a/ext/POSIX/lib/POSIX.pm b/ext/POSIX/lib/POSIX.pm index a825178..2a78f19 100644 --- a/ext/POSIX/lib/POSIX.pm +++ b/ext/POSIX/lib/POSIX.pm @@ -4,7 +4,7 @@ use warnings; our ($AUTOLOAD, %SIGRT); -our $VERSION = '1.51'; +our $VERSION = '1.52'; require XSLoader; diff --git a/ext/POSIX/t/posix.t b/ext/POSIX/t/posix.t index 9495fcc..ec25d3a 100644 --- a/ext/POSIX/t/posix.t +++ b/ext/POSIX/t/posix.t @@ -6,6 +6,7 @@ BEGIN { print "1..0\n"; exit 0; } + require 'loc_tools.pl'; } use Test::More tests => 120; @@ -344,7 +345,8 @@ eval { use strict; POSIX->import("S_ISBLK"); my $x = S_ISBLK }; unlike( $@, qr/Can't use string .* as a symbol ref/, "Can import autoloaded constants" ); SKIP: { - skip("localeconv() not present", 26) unless $Config{d_locconv}; + skip("locales not available", 26) unless locales_enabled(qw(NUMERIC MONETARY)); + skip("localeconv() not available", 26) unless $Config{d_locconv}; my $conv = localeconv; is(ref $conv, 'HASH', 'localconv returns a hash reference'); diff --git a/ext/re/t/reflags.t b/ext/re/t/reflags.t index 03c35a0..fd1c35a 100644 --- a/ext/re/t/reflags.t +++ b/ext/re/t/reflags.t @@ -6,6 +6,7 @@ BEGIN { print "1..0 # Skip -- Perl configured without re module\n"; exit 0; } + require 'loc_tools.pl'; } use strict; @@ -66,12 +67,7 @@ ok 'f r e l p' =~ /f r e l p/, } SKIP: { - if ( - !$Config::Config{d_setlocale} - || $Config::Config{ccflags} =~ /\bD?NO_LOCALE\b/ - ) { - skip "no locale support", 7 - } + skip "no locale support", 7 unless locales_enabled('CTYPE'); use locale; use re '/u'; is qr//, '(?^u:)', 'use re "/u" with active locale'; diff --git a/lib/locale.pm b/lib/locale.pm index 61e77c7..9cc243f 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 5012d3b..3f37457 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,14 +1906,16 @@ foreach my $Locale (@Locale) { } $ok21 = 1; - foreach my $err (keys %!) { - no locale; - use Errno; - $! = eval "&Errno::$err"; # Convert to strerror() output - my $strerror = "$!"; - if ("$strerror" =~ /\P{ASCII}/) { - $ok21 = 0; - last; + if (locales_enabled('LC_MESSAGES')) { + foreach my $err (keys %!) { + no locale; + use Errno; + $! = eval "&Errno::$err"; # Convert to strerror() output + my $strerror = "$!"; + if ("$strerror" =~ /\P{ASCII}/) { + $ok21 = 0; + last; + } } } diff --git a/perl.h b/perl.h index 109ab6a..b6b232f 100644 --- a/perl.h +++ b/perl.h @@ -5809,12 +5809,16 @@ typedef struct am_table_short AMTS; * this will so rarely be true, there is no point to optimize for * time; instead it makes sense to minimize space used and do all the * work in the rarely called function */ -# define _CHECK_AND_WARN_PROBLEMATIC_LOCALE \ - STMT_START { \ - if (UNLIKELY(PL_warn_locale)) { \ - _warn_problematic_locale(); \ - } \ - } STMT_END +# ifdef USE_LOCALE_CTYPE +# define _CHECK_AND_WARN_PROBLEMATIC_LOCALE \ + STMT_START { \ + if (UNLIKELY(PL_warn_locale)) { \ + _warn_problematic_locale(); \ + } \ + } STMT_END +# else +# define _CHECK_AND_WARN_PROBLEMATIC_LOCALE +# endif /* These two internal macros are called when a warning should be raised, diff --git a/t/lib/warnings/regexec b/t/lib/warnings/regexec index 3f15db0..d956cb8 100644 --- a/t/lib/warnings/regexec +++ b/t/lib/warnings/regexec @@ -119,6 +119,10 @@ EXPECT ######## # NAME Wide character in non-UTF-8 locale +require '../loc_tools.pl'; +unless (locales_enabled()) { + print("SKIPPED\n# locales not available\n"),exit; +} eval { require POSIX; POSIX->import("locale_h") }; if ($@) { print("SKIPPED\n# no POSIX\n"),exit; @@ -133,16 +137,16 @@ setlocale(&POSIX::LC_CTYPE, "C"); "\x{100}" =~ /[\x{100}\x{102}]/l; no warnings 'locale'; EXPECT -Wide character (U+100) in pattern match (m//) at - line 8. -Wide character (U+100) in pattern match (m//) at - line 8. -Wide character (U+100) in pattern match (m//) at - line 9. -Wide character (U+100) in pattern match (m//) at - line 9. -Wide character (U+100) in pattern match (m//) at - line 9. -Wide character (U+100) in pattern match (m//) at - line 10. -Wide character (U+100) in pattern match (m//) at - line 10. -Wide character (U+100) in pattern match (m//) at - line 11. Wide character (U+100) in pattern match (m//) at - line 12. Wide character (U+100) in pattern match (m//) at - line 12. +Wide character (U+100) in pattern match (m//) at - line 13. +Wide character (U+100) in pattern match (m//) at - line 13. +Wide character (U+100) in pattern match (m//) at - line 13. +Wide character (U+100) in pattern match (m//) at - line 14. +Wide character (U+100) in pattern match (m//) at - line 14. +Wide character (U+100) in pattern match (m//) at - line 15. +Wide character (U+100) in pattern match (m//) at - line 16. +Wide character (U+100) in pattern match (m//) at - line 16. ######## # NAME \b{} in non-UTF-8 locale eval { require POSIX; POSIX->import("locale_h") }; diff --git a/t/lib/warnings/utf8 b/t/lib/warnings/utf8 index 4a7cef1..d8f301d 100644 --- a/t/lib/warnings/utf8 +++ b/t/lib/warnings/utf8 @@ -583,6 +583,10 @@ close $fh; EXPECT ######## # NAME Case change crosses 255/256 under non-UTF8 locale +require '../loc_tools.pl'; +unless (locales_enabled('LC_CTYPE')) { + print("SKIPPED\n# locales not available\n"),exit; +} eval { require POSIX; POSIX->import("locale_h") }; if ($@) { print("SKIPPED\n# no POSIX\n"),exit; @@ -606,14 +610,18 @@ $a = uc("\x{FB00}"); $a = ucfirst("\x{149}"); $a = lcfirst("\x{178}"); EXPECT -Can't do lc("\x{178}") on non-UTF-8 locale; resolved to "\x{178}". at - line 10. -Can't do fc("\x{1E9E}") on non-UTF-8 locale; resolved to "\x{17F}\x{17F}". at - line 11. -Can't do fc("\x{FB05}") on non-UTF-8 locale; resolved to "\x{FB06}". at - line 12. -Can't do uc("\x{FB00}") on non-UTF-8 locale; resolved to "\x{FB00}". at - line 13. -Can't do ucfirst("\x{149}") on non-UTF-8 locale; resolved to "\x{149}". at - line 14. -Can't do lcfirst("\x{178}") on non-UTF-8 locale; resolved to "\x{178}". at - line 15. +Can't do lc("\x{178}") on non-UTF-8 locale; resolved to "\x{178}". at - line 14. +Can't do fc("\x{1E9E}") on non-UTF-8 locale; resolved to "\x{17F}\x{17F}". at - line 15. +Can't do fc("\x{FB05}") on non-UTF-8 locale; resolved to "\x{FB06}". at - line 16. +Can't do uc("\x{FB00}") on non-UTF-8 locale; resolved to "\x{FB00}". at - line 17. +Can't do ucfirst("\x{149}") on non-UTF-8 locale; resolved to "\x{149}". at - line 18. +Can't do lcfirst("\x{178}") on non-UTF-8 locale; resolved to "\x{178}". at - line 19. ######## # NAME Wide character in non-UTF-8 locale +require '../loc_tools.pl'; +unless (locales_enabled('LC_CTYPE')) { + print("SKIPPED\n# locales not available\n"),exit; +} eval { require POSIX; POSIX->import("locale_h") }; if ($@) { print("SKIPPED\n# no POSIX\n"),exit; @@ -635,8 +643,8 @@ $a = fc("\x{102}"); $a = uc("\x{103}"); $a = ucfirst("\x{104}"); EXPECT -Wide character (U+100) in lc at - line 10. -Wide character (U+101) in lcfirst at - line 11. -Wide character (U+102) in fc at - line 12. -Wide character (U+103) in uc at - line 13. -Wide character (U+104) in ucfirst at - line 14. +Wide character (U+100) in lc at - line 14. +Wide character (U+101) in lcfirst at - line 15. +Wide character (U+102) in fc at - line 16. +Wide character (U+103) in uc at - line 17. +Wide character (U+104) in ucfirst at - line 18. diff --git a/t/loc_tools.pl b/t/loc_tools.pl index 6a6cdf4..9e4320b 100644 --- a/t/loc_tools.pl +++ b/t/loc_tools.pl @@ -73,6 +73,65 @@ sub _decode_encodings { return @enc; } +# Initialize this hash so that it looks like e.g., +# 6 => 'CTYPE', +# where 6 is the value of &POSIX::LC_CTYPE +my %category_name; +eval { require POSIX; import POSIX 'locale_h'; }; +unless ($@) { + foreach my $name (qw(ALL COLLATE CTYPE MESSAGES MONETARY NUMERIC TIME)) { + my $number = eval "&POSIX::LC_$name"; + next if $@; + $category_name{$number} = "$name"; + } +} + +sub locales_enabled(;$) { + # Returns 0 if no locale handling is available on this platform; otherwise + # 1. + # + # The optional parameter is a reference to a list of individual POSIX + # locale categories. If present, this function also returns 0 if any of + # them are individually not available on this platform; otherwise 1. + # Actually, it is acceptable for the list to be just a simple scalar + # denoting a single category. + # + # If any of the individual categories specified by the optional parameter + # is all digits, it is taken to be the C enum for the category (e.g., + # &POSIX::LC_CTYPE). Otherwise it should be a string name of the + # category, like 'LC_TIME'. The initial 'LC_' is optional. It is a fatal + # error to call this with something that isn't a known category + + use Config;; + + return 0 unless $Config{d_setlocale} + # I (khw) cargo-culted the '?' in the pattern on the + # next line. + && $Config{ccflags} !~ /\bD?NO_LOCALE\b/; + + # Done with the global possibilities. Now check if any passed in category + # is disabled. + my $categories_ref = shift; + $categories_ref = [ $categories_ref ] if ! ref $categories_ref; + for my $category (@$categories_ref) { + if ($category =~ /\D/) { + $category =~ s/ ^ LC_ //x; + die "Invalid locale category name '$category'" + unless grep { $category eq $_ } values %category_name; + } + else { + die "Invalid locale category number '$category'" + unless grep { $category == $_ } keys %category_name; + $category = $category_name{$category}; + } + + return 0 if $Config{ccflags} =~ /\bD?NO_LOCALE_$category\b/; + } + + return 1; +} + + sub find_locales ($;$) { # Returns an array of all the locales we found on the # system. If the optional 2nd parameter is # non-zero, the list is restricted to those locales @@ -84,8 +143,7 @@ sub find_locales ($;$) { # Returns an array of all the locales we found on the my $categories = shift; my $only_plays_well = shift // 0; - use Config;; - my $have_setlocale = $Config{d_setlocale}; + return unless locales_enabled($categories); # Visual C's CRT goes silly on strings of the form "en_US.ISO8859-1" # and mingw32 uses said silly CRT @@ -93,13 +151,11 @@ sub find_locales ($;$) { # Returns an array of all the locales we found on the # so re-enable the tests for Windows XP onwards. my $winxp = ($^O eq 'MSWin32' && defined &Win32::GetOSVersion && join('.', (Win32::GetOSVersion())[1..2]) >= 5.1); - $have_setlocale = 0 if ((($^O eq 'MSWin32' && !$winxp) || $^O eq 'NetWare') && - $Config{cc} =~ /^(cl|gcc|g\+\+|ici)/i); + return if ((($^O eq 'MSWin32' && !$winxp) || $^O eq 'NetWare') + && $Config{cc} =~ /^(cl|gcc|g\+\+|ici)/i); # UWIN seems to loop after taint tests, just skip for now - $have_setlocale = 0 if ($^O =~ /^uwin/); - - return unless $have_setlocale; + return if ($^O =~ /^uwin/); # Done this way in case this is 'required' in the caller before seeing if # this is miniperl. @@ -229,6 +285,7 @@ sub is_locale_utf8 ($) { # Return a boolean as to if core Perl thinks the input eval { require POSIX; import POSIX 'locale_h'; }; return 0 if ! defined &POSIX::LC_CTYPE; + return 0 if ! locales_enabled('LC_CTYPE'); my $locale = shift; diff --git a/t/op/quotemeta.t b/t/op/quotemeta.t index 9ba3f09..35ed2c6 100644 --- a/t/op/quotemeta.t +++ b/t/op/quotemeta.t @@ -5,6 +5,7 @@ BEGIN { @INC = qw(../lib .); require Config; import Config; require "./test.pl"; + require "./loc_tools.pl"; } plan tests => 60; @@ -80,7 +81,7 @@ is(length(quotemeta($char)), 1, "quotemeta '\\N{U+DF}' in UTF-8 length"); is(length(quotemeta("\x{df}")), 2, "quotemeta Latin1 no unicode_strings quoted length"); SKIP: { - skip 'No locale testing without d_setlocale', 8 if(!$Config{d_setlocale}); + skip 'Locales not available', 8 unless locales_enabled('LC_CTYPE'); use locale; my $char = ":"; @@ -109,7 +110,7 @@ is(length(quotemeta($char)), 1, "quotemeta '\\N{U+DF}' in UTF-8 length"); is(length(quotemeta("\x{df}")), 1, "quotemeta Latin1 unicode_strings nonquoted length"); SKIP: { - skip 'No locale testing without d_setlocale', 12 if(!$Config{d_setlocale}); + skip 'Locales not available', 12 unless locales_enabled('LC_CTYPE'); use locale; my $char = ":"; diff --git a/t/op/taint.t b/t/op/taint.t index de30a9b..08afc78 100644 --- a/t/op/taint.t +++ b/t/op/taint.t @@ -10,6 +10,7 @@ BEGIN { chdir 't' if -d 't'; require './test.pl'; + require './loc_tools.pl'; set_up_inc('../lib'); } @@ -298,7 +299,7 @@ my $TEST = 'TEST'; is($one, 'a', "$desc: \$1 value"); SKIP: { - skip 'No locale testing without d_setlocale', 10 if(!$Config{d_setlocale}); + skip 'Locales not available', 10 unless locales_enabled('LC_CTYPE'); $desc = "match with pattern tainted via locale"; @@ -351,7 +352,7 @@ my $TEST = 'TEST'; is($one, 'd', "$desc: \$1 value"); SKIP: { - skip 'No locale testing without d_setlocale', 12 if(!$Config{d_setlocale}); + skip 'Locales not available', 12 unless locales_enabled('LC_CTYPE'); $desc = "match with pattern tainted via locale, list cxt"; @@ -503,7 +504,7 @@ my $TEST = 'TEST'; is($one, 'abcd', "$desc: \$1 value"); SKIP: { - skip 'No locale testing without d_setlocale', 18 if(!$Config{d_setlocale}); + skip 'Locales not available', 18 unless locales_enabled('LC_CTYPE'); $desc = "substitution with pattern tainted via locale"; @@ -687,7 +688,7 @@ my $TEST = 'TEST'; is($one, 'a', "$desc: \$1 value"); SKIP: { - skip 'No locale testing without d_setlocale', 10 if(!$Config{d_setlocale}); + skip 'Locales not available', 10 unless locales_enabled('LC_CTYPE'); $desc = "use re 'taint': match with pattern tainted via locale"; @@ -740,7 +741,7 @@ my $TEST = 'TEST'; is($one, 'd', "$desc: \$1 value"); SKIP: { - skip 'No locale testing without d_setlocale', 12 if(!$Config{d_setlocale}); + skip 'Locales not available', 12 unless locales_enabled('LC_CTYPE'); $desc = "use re 'taint': match with pattern tainted via locale, list cxt"; @@ -893,7 +894,7 @@ my $TEST = 'TEST'; is($one, 'abcd', "$desc: \$1 value"); SKIP: { - skip 'No locale testing without d_setlocale', 18 if(!$Config{d_setlocale}); + skip 'Locales not available', 18 unless locales_enabled('LC_CTYPE'); $desc = "use re 'taint': substitution with pattern tainted via locale"; @@ -2297,7 +2298,7 @@ pass("no death when TARG of ref is tainted"); } SKIP: { - skip 'No locale testing without d_setlocale', 4 if(!$Config{d_setlocale}); + skip 'Locales not available', 4 unless locales_enabled('LC_CTYPE'); use feature 'fc'; use locale; diff --git a/t/re/charset.t b/t/re/charset.t index 4c3e537..7a5852a 100644 --- a/t/re/charset.t +++ b/t/re/charset.t @@ -41,7 +41,7 @@ $testcases{'[:word:]'} = $testcases{'\w'}; my $utf8_locale; my @charsets = qw(a d u aa); -if (! is_miniperl() && $Config{d_setlocale}) { +if (! is_miniperl() && locales_enabled('LC_CTYPE')) { require POSIX; my $current_locale = POSIX::setlocale( &POSIX::LC_ALL, "C") // ""; if ($current_locale eq 'C') { diff --git a/t/re/pat.t b/t/re/pat.t index a60bfe5..64f6487 100644 --- a/t/re/pat.t +++ b/t/re/pat.t @@ -18,6 +18,7 @@ BEGIN { @INC = ('../lib','.','../ext/re'); require Config; import Config; require './test.pl'; require './charset_tools.pl'; + require './loc_tools.pl'; skip_all('no re module') unless defined &DynaLoader::boot_DynaLoader; skip_all_without_unicode_tables(); } @@ -522,7 +523,7 @@ sub run_tests { my $locale; SKIP: { - skip 'No locale testing without d_setlocale', 1 if(!$Config{d_setlocale}); + skip 'Locales not available', 1 unless locales_enabled('LC_CTYPE'); use locale; $locale = qr/\b\v$/; @@ -536,22 +537,21 @@ sub run_tests { is(qr/abc$dual/, '(?^u:abc(?^:\b\v$))', 'Verify retains d meaning when interpolated under locale'); SKIP: { - skip 'No locale testing without d_setlocale', 1 if(!$Config{d_setlocale}); + skip 'Locales not available', 1 unless locales_enabled('LC_CTYPE'); is(qr/abc$locale/, '(?^u:abc(?^l:\b\v$))', 'Verify retains l when interpolated under unicode_strings'); } no feature 'unicode_strings'; SKIP: { - skip 'No locale testing without d_setlocale', 1 if(!$Config{d_setlocale}); - + skip 'Locales not available', 1 unless locales_enabled('LC_CTYPE'); is(qr/abc$locale/, '(?^:abc(?^l:\b\v$))', 'Verify retains l when interpolated outside locale and unicode strings'); } is(qr/def$unicode/, '(?^:def(?^u:\b\v$))', 'Verify retains u when interpolated outside locale and unicode strings'); SKIP: { - skip 'No locale testing without d_setlocale', 2 if(!$Config{d_setlocale}); + skip 'Locales not available', 2 unless locales_enabled('LC_CTYPE'); use locale; is(qr/abc$dual/, '(?^l:abc(?^:\b\v$))', 'Verify retains d meaning when interpolated under locale'); diff --git a/t/uni/fold.t b/t/uni/fold.t index deb47f7..149573a 100644 --- a/t/uni/fold.t +++ b/t/uni/fold.t @@ -446,7 +446,7 @@ SKIP: { utf8::upgrade($utf8); is(fc($latin1), fc($utf8), "fc() gives the same results for \\x{$_} in Latin-1 and UTF-8 under unicode_strings"); SKIP: { - skip 'No locale testing without d_setlocale', 2 if(!$Config{d_setlocale}); + skip 'Locales not available', 2 unless locales_enabled('LC_CTYPE'); use locale; is(fc($latin1), lc($latin1), "use locale; fc(qq{\\x{$_}}), lc(qq{\\x{$_}}) when qq{\\x{$_}} is in latin-1"); is(fc($utf8), lc($utf8), "use locale; fc(qq{\\x{$_}}), lc(qq{\\x{$_}}) when qq{\\x{$_}} is in latin-1"); -- Perl5 Master Repository
