This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Forgot the latest mktables.PL from #9899.
[perl5.git] / t / op / pat.t
index 6b038a5..9130454 100755 (executable)
@@ -4,16 +4,17 @@
 # the format supported by op/regexp.t.  If you want to add a test
 # that does fit that format, add it to op/re_tests, not here.
 
-print "1..581\n";
+$| = 1;
+print "1..587\n";
 
 BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
 }
-eval 'use Config';          #  Defaults assumed if this fails
 
-# XXX known to leak scalars
-$ENV{PERL_DESTRUCT_LEVEL} = 0 unless $ENV{PERL_DESTRUCT_LEVEL} > 3;
+use re 'asciirange'; # Compute ranges in ASCII space
+
+eval 'use Config';          #  Defaults assumed if this fails
 
 $x = "abc\ndef\n";
 
@@ -1546,3 +1547,39 @@ print "ok 247\n";
 
     print "ok 581\n";
 }
+
+{
+    $test = 582;
+
+    # bugid 20010410.006
+    for my $rx (
+               '/(.*?)\{(.*?)\}/csg',
+               '/(.*?)\{(.*?)\}/cg',
+               '/(.*?)\{(.*?)\}/sg',
+               '/(.*?)\{(.*?)\}/g',
+               '/(.+?)\{(.+?)\}/csg',
+              )
+    {
+       my($input, $i);
+
+       $i = 0;
+       $input = "a{b}c{d}";
+        eval <<EOT;
+       while (eval \$input =~ $rx) {
+           print "# \\\$1 = '\$1' \\\$2 = '\$2'\n";
+           ++\$i;
+       }
+EOT
+       print "not " unless $i == 2;
+       print "ok " . $test++ . "\n";
+    }
+}
+
+{
+    # from Robin Houston
+
+    my $x = "\x{12345678}";
+    $x =~ s/(.)/$1/g;
+    print "not " unless ord($x) == 0x12345678 && length($x) == 1;
+    print "ok 587\n";
+}