require './test.pl';
set_up_inc('../lib');
skip_all_without_unicode_tables();
+ skip_all_if_miniperl("miniperl, no Unicode::Normalize");
require Config; import Config;
require './charset_tools.pl';
require './loc_tools.pl'; # Contains find_utf8_ctype_locale()
# since they use '$u', they are left out of the main loop
$test = qq[ my \$s = ":$u:"; utf8::upgrade(\$s); \$s =~ /:[_$c]:/i];
ok eval $test, "$code - $name - $mapping - $type - $test";
+
+ my $bracketed_f = ($f =~ s/(.)/[$1]/gr);
+ $test = qq[":$c:" =~ /:$bracketed_f:/iu];
+ ok eval $test, "$code - $name - $mapping - $type - $test";
+
+ my @f_chars = ($f =~ / (.) (.) (.?) /x);
+ my $every_other_bracketed_f = "[$f_chars[0]]$f_chars[1]";
+ $every_other_bracketed_f .= "[$f_chars[2]]" if $f_chars[2];
+ $test = qq[":$c:" =~ /:$every_other_bracketed_f:/iu];
+ ok eval $test, "$code - $name - $mapping - $type - $test";
+
+ my $other_every_bracketed_f = "$f_chars[0]";
+ $other_every_bracketed_f .= "[$f_chars[1]]";
+ $other_every_bracketed_f .= "$f_chars[2]" if $f_chars[2];
+ $test = qq[":$c:" =~ /:$other_every_bracketed_f:/iu];
+ ok eval $test, "$code - $name - $mapping - $type - $test";
}
}
SKIP: {
use feature qw( fc unicode_strings );
- eval { require POSIX; import POSIX 'locale_h'; };
- unless (defined &POSIX::LC_ALL) {
- skip "no POSIX (or no Fcntl, or no dynamic loading)", 256;
- }
+ skip "locales not available", 256 unless locales_enabled('LC_ALL');
- setlocale(&POSIX::LC_ALL, "C") if $Config{d_setlocale};
+ setlocale(&POSIX::LC_ALL, "C");
# This tests both code paths in pp_fc
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");