Lots of consting
[p5sagit/p5-mst-13.2.git] / t / op / regexp.t
index 5a31696..b4288b2 100755 (executable)
@@ -49,6 +49,7 @@ $. = 0;
 $bang = sprintf "\\%03o", ord "!"; # \41 would not be portable.
 $ffff  = chr(0xff) x 2;
 $nulnul = "\0" x 2;
+$OP = $qr ? 'qr' : 'm';
 
 $| = 1;
 print "1..$numtests\n# $iters iterations\n";
@@ -69,11 +70,11 @@ while (<TESTS>) {
     $expect =~ s/\\n/\n/g;
     $expect = $repl = '-' if $skip_amp and $input =~ /\$[&\`\']/;
     $skip = ($skip_amp ? ($result =~ s/B//i) : ($result =~ s/B//));
-    $reason = $skip_amp ? 'skipping $&' : '';
+    $reason = 'skipping $&' if $reason eq  '' && $skip_amp;
     $result =~ s/B//i unless $skip;
     for $study ('', 'study \$subject') {
        $c = $iters;
-       eval "$study; \$match = (\$subject =~ m$pat) while \$c--; \$got = \"$repl\";";
+       eval "$study; \$match = (\$subject =~ $OP$pat) while \$c--; \$got = \"$repl\";";
        chomp( $err = $@ );
        if ($result eq 'c') {
            if ($err !~ m!^\Q$expect!) { print "not ok $. (compile) $input => `$err'\n"; next TEST }