This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Deparse: mark "$a[0]\[1]" TODO
[perl5.git] / t / uni / fold.t
index deb47f7..bd1dd85 100644 (file)
@@ -9,6 +9,7 @@ BEGIN {
     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()
@@ -154,6 +155,22 @@ foreach my $test_ref (@CF) {
         # 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";
     }
 }
 
@@ -430,12 +447,9 @@ foreach my $test_ref (@CF) {
 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
 
@@ -446,7 +460,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");