diff options
author | Nicholas Clark <nick@ccl4.org> | 2007-02-01 16:27:00 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2007-02-01 16:27:00 +0000 |
commit | 1286eaeb2de3949c39fce40ec1f0140e47e5abe6 (patch) | |
tree | 922e8e7e195f1caa9c947c68e2bfaa720263bea9 /t | |
parent | 6d7e4387f586ed0a50c72bc4a94d68216f838d91 (diff) | |
download | perl-1286eaeb2de3949c39fce40ec1f0140e47e5abe6.tar.gz |
Make t/op/regexp.t run under use strict; including removing the
vestiges of change 1195 not removed by change 1244.
p4raw-id: //depot/perl@30088
Diffstat (limited to 't')
-rw-r--r-- | t/op/re_tests | 2 | ||||
-rwxr-xr-x | t/op/regexp.t | 28 |
2 files changed, 12 insertions, 18 deletions
diff --git a/t/op/re_tests b/t/op/re_tests index fca6b11f4e..e2b33fb84a 100644 --- a/t/op/re_tests +++ b/t/op/re_tests @@ -497,7 +497,7 @@ a(?{}})b - c - a(?{"{"})b - c - Sequence (?{...}) not terminated or not {}-balanced a(?{"\{"})b cabd y $& ab a(?{"{"}})b - c - Unmatched right curly bracket -a(?{$bl="\{"}).b caxbd y $bl { +a(?{$::bl="\{"}).b caxbd y $::bl { x(~~)*(?:(?:F)?)? x~~ y - - ^a(?#xxx){3}c aaac y $& aaac '^a (?#xxx) (?#yyy) {3}c'x aaac y $& aaac diff --git a/t/op/regexp.t b/t/op/regexp.t index a7cd5fc7b9..f416f29560 100755 --- a/t/op/regexp.t +++ b/t/op/regexp.t @@ -41,6 +41,9 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; } +use strict; +use vars qw($iters $numtests $bang $ffff $nulnul $OP); +use vars qw($qr $skip_amp $qr_embed); # set by our callers $iters = shift || 1; # Poor man performance suite, 10000 is OK. @@ -68,22 +71,21 @@ while (<TESTS>) { } chomp; s/\\n/\n/g; - ($pat, $subject, $result, $repl, $expect, $reason) = split(/\t/,$_,6); - $input = join(':',$pat,$subject,$result,$repl,$expect); - infty_subst(\$pat); - infty_subst(\$expect); + my ($pat, $subject, $result, $repl, $expect, $reason) = split(/\t/,$_,6); + my $input = join(':',$pat,$subject,$result,$repl,$expect); $pat = "'$pat'" unless $pat =~ /^[:'\/]/; $pat =~ s/(\$\{\w+\})/$1/eeg; $pat =~ s/\\n/\n/g; $subject = eval qq("$subject"); $expect = eval qq("$expect"); $expect = $repl = '-' if $skip_amp and $input =~ /\$[&\`\']/; - $skip = ($skip_amp ? ($result =~ s/B//i) : ($result =~ s/B//)); + my $skip = ($skip_amp ? ($result =~ s/B//i) : ($result =~ s/B//)); $reason = 'skipping $&' if $reason eq '' && $skip_amp; $result =~ s/B//i unless $skip; - for $study ('', 'study $subject') { - $c = $iters; + for my $study ('', 'study $subject') { + my $c = $iters; + my ($code, $match, $got); if ($repl eq 'pos') { $code= <<EOFCODE; $study; @@ -103,12 +105,12 @@ EOFCODE else { $code= <<EOFCODE; $study; - \$match = (\$subject =~ $OP$pat$addg) while \$c--; + \$match = (\$subject =~ $OP$pat) while \$c--; \$got = "$repl"; EOFCODE } eval $code; - chomp( $err = $@ ); + chomp( my $err = $@ ); if ($result eq 'c') { if ($err !~ m!^\Q$expect!) { print "not ok $. (compile) $input => `$err'\n"; next TEST } last; # no need to study a syntax error @@ -142,11 +144,3 @@ EOFCODE } close(TESTS); - -sub infty_subst # Special-case substitution -{ # of $reg_infty and friends - my $tp = shift; - $$tp =~ s/,\$reg_infty_m}/,$reg_infty_m}/o; - $$tp =~ s/,\$reg_infty_p}/,$reg_infty_p}/o; - $$tp =~ s/,\$reg_infty}/,$reg_infty}/o; -} |