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 | |
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')
-rw-r--r-- | t/op/re_tests | 6 | ||||
-rwxr-xr-x | t/op/regexp.t | 25 |
2 files changed, 26 insertions, 5 deletions
diff --git a/t/op/re_tests b/t/op/re_tests index 9217fcca1f..6154bff340 100644 --- a/t/op/re_tests +++ b/t/op/re_tests @@ -354,9 +354,9 @@ a(?:b|(c|e){1,2}?|d)+?(.) ace y $1$2 ce '(ab)\d\1'i Ab4ab y $1 Ab '(ab)\d\1'i ab4Ab y $1 ab foo\w*\d{4}baz foobar1234baz y $& foobar1234baz -a{1,32766} aaa y $& aaa -a{1,32767} - c - /a{1,32767}/: Quantifier in {,} bigger than -a{1,32768} - c - /a{1,32768}/: Quantifier in {,} bigger than +a{1,$reg_infty_m} aaa y $& aaa +a{1,$reg_infty} - c - /a{1,$reg_infty}/: Quantifier in {,} bigger than +a{1,$reg_infty_p} - c - /a{1,$reg_infty_p}/: Quantifier in {,} bigger than a(?{})b cabd y $& ab a(?{)b - c - /a(?{)b/: Sequence (?{...}) not terminated or not {}-balanced a(?{{})b - c - /a(?{{})b/: Sequence (?{...}) not terminated or not {}-balanced 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; +} |