In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/f1c605336053dab86b920ac27a6262e25665bc65?hp=92361f5e167f608ba46fdd5ce2e1672a004bd90c>

- Log -----------------------------------------------------------------
commit f1c605336053dab86b920ac27a6262e25665bc65
Author: OtrsUser <o...@ubuntu.(none)>
Date:   Tue Dec 14 03:11:48 2010 -0800

    add some tests for the regex flags u, d, and l
-----------------------------------------------------------------------

Summary of changes:
 t/re/re.t |   45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/t/re/re.t b/t/re/re.t
index f1002fa..5ed4fa8 100644
--- a/t/re/re.t
+++ b/t/re/re.t
@@ -8,6 +8,7 @@ BEGIN {
 
 use strict;
 use warnings;
+use POSIX;
 
 use re qw(is_regexp regexp_pattern
           regname regnames regnames_count);
@@ -66,6 +67,48 @@ if ('1234'=~/(?:(?<A>\d)|(?<C>!))(?<B>\d)(?<A>\d)(?<B>\d)/){
         pass("qr/\18/ didn't loop");
     }
 
+{
+    # tests for new regexp flags
+    my $text = 'ä';
+    my $check;
+
+    {
+        # check u/d-flag without setting a locale
+        $check = $text =~ /(?u)\w/;
+        ok( $check );
+        $check = $text =~ /(?d)\w/;
+        ok( !$check );
+    }
+
+    SKIP: {
+        my $current_locale = POSIX::setlocale( &POSIX::LC_CTYPE, 
'de_DE.ISO-8859-1' );
+        if ( !$current_locale || $current_locale ne 'de_DE.ISO-8859-1' ) {
+            skip( 'cannot use locale de_DE.ISO-8859-1', 3 );
+        }
+
+        $check = $text =~ /(?u)\w/;
+        ok( $check );
+        $check = $text =~ /(?d)\w/;
+        ok( !$check );
+        $check = $text =~ /(?l)\w/;
+        ok( $check );
+    }
+
+    SKIP: {
+        my $current_locale = POSIX::setlocale( &POSIX::LC_CTYPE, 'en_US.UTF-8' 
);
+        if ( !$current_locale || $current_locale ne 'en_US.UTF-8' ) {
+            skip( 'cannot use locale en_US.UTF-8', 3 );
+        }
+
+        $check = $text =~ /(?u)\w/;
+        ok( $check );
+        $check = $text =~ /(?d)\w/;
+        ok( !$check );
+        $check = $text =~ /(?l)\w/;
+        ok( !$check );
+    }
+}
+
 # New tests above this line, don't forget to update the test count below!
-BEGIN { plan tests => 20 }
+BEGIN { plan tests => 28 }
 # No tests here!

--
Perl5 Master Repository

Reply via email to