diff options
author | Dominic Dunlop <domo@computer.org> | 1998-06-22 15:22:24 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-06-23 05:43:32 +0000 |
commit | 83e898de4c33570d7f7c201c6f693bc6bd7ed922 (patch) | |
tree | 65869158b66f1059c09457910fd0916dee94ac47 /t/op/regexp.t | |
parent | 048b2c9775bab3dc234bc0f1bee2357fca20cec3 (diff) | |
download | perl-83e898de4c33570d7f7c201c6f693bc6bd7ed922.tar.gz |
Amend tests/regexp.t for variable REG_INFTY;
Message-Id: <v03110700b1b41e1760b2@[195.95.102.55]>
update machten.sh to vary REG_INFTY
p4raw-id: //depot/perl@1195
Diffstat (limited to 't/op/regexp.t')
-rwxr-xr-x | t/op/regexp.t | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/t/op/regexp.t b/t/op/regexp.t index 273608433e..a4783bac2f 100755 --- a/t/op/regexp.t +++ b/t/op/regexp.t @@ -22,11 +22,22 @@ # interpolating that string after the match, or start of error message. # # Columns 1, 2 and 5 are \n-interpolated. +# +# The variables $reg_infty, $reg_infty_m and $reg_infty_m in columns 1 +# and 5 are replaced respectively with the configuration value reg_infty, +# reg_infty-1 and reg_infty+1, or if reg_infty is not defined in the +# configuration, default values. No other variables are substituted. + $iters = shift || 1; # Poor man performance suite, 10000 is OK. -open(TESTS,'op/re_tests') || open(TESTS,'t/op/re_tests') - || die "Can't open re_tests"; +chdir 't' if -d 't'; +@INC = "../lib"; +eval 'use Config'; # Defaults assumed if this fails +$reg_infty = defined $Config{reg_infty} ? $Config{reg_infty} : 32767; +$reg_infty_m = $reg_infty - 1; $reg_infty_p = $reg_infty + 1; + +open(TESTS,'op/re_tests') || die "Can't open re_tests"; while (<TESTS>) { } $numtests = $.; @@ -39,6 +50,8 @@ TEST: while (<TESTS>) { ($pat, $subject, $result, $repl, $expect) = split(/[\t\n]/,$_); $input = join(':',$pat,$subject,$result,$repl,$expect); + infty_subst(\$pat); + infty_subst(\$expect); $pat = "'$pat'" unless $pat =~ /^[:']/; $pat =~ s/\\n/\n/g; $subject =~ s/\\n/\n/g; @@ -69,3 +82,11 @@ while (<TESTS>) { } 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; +} |