chdir 't' if -d 't';
@INC = '../lib';
}
+our $Message = "Line";
eval 'use Config'; # Defaults assumed if this fails
sub ok ($;$) {
my($ok, $name) = @_;
- printf "%sok %d - %s\n", ($ok ? "" : "not "), $test, $name||'unnamed';
+ printf "%sok %d - %s\n", ($ok ? "" : "not "), $test,
+ $name||"$Message:".((caller)[2]);
printf "# Failed test at line %d\n", (caller)[2] unless $ok;
my $ok= $got eq $expect;
- printf "%sok %d - %s\n", ($ok ? "" : "not "), $test, $name||'unnamed';
+ printf "%sok %d - %s\n", ($ok ? "" : "not "), $test,
+ $name||"$Message:".((caller)[2]);
printf "# Failed test at line %d\n".
"# expected: %s\n".
}
{
# Test named commits and the $REGERROR var
+ local $Message = "\$REGERROR";
our $REGERROR;
for $word (qw(bar baz bop)) {
$REGERROR="";
}
}
{ #Regression test for perlbug 40684
+ local $Message = "RT#40684 tests:";
my $s = "abc\ndef";
my $rex = qr'^abc$'m;
ok($s =~ m/$rex/);
}
{
+ local $Message = "Relative Recursion";
my $parens=qr/(\((?:[^()]++|(?-1))*+\))/;
local $_='foo((2*3)+4-3) + bar(2*(3+4)-1*(2-3))';
my ($all,$one,$two)=('','','');
iseq($_,$spaces,"SUSPEND final string");
iseq($count,1,"Optimiser should have prevented more than one match");
}
+{
+ local $Message = "RT#36909 test";
+ $^R = 'Nothing';
+ {
+ local $^R = "Bad";
+ ok('x foofoo y' =~ m{
+ (foo) # $^R correctly set
+ (?{ "last regexp code result" })
+ }x);
+ iseq($^R,'last regexp code result');
+ }
+ iseq($^R,'Nothing');
+ {
+ local $^R = "Bad";
+
+ ok('x foofoo y' =~ m{
+ (?:foo|bar)+ # $^R correctly set
+ (?{"last regexp code result"})
+ }x);
+ iseq($^R,'last regexp code result');
+ }
+ iseq($^R,'Nothing');
+
+ {
+ local $^R = "Bad";
+ ok('x foofoo y' =~ m{
+ (foo|bar)\1+ # $^R undefined
+ (?{"last regexp code result"})
+ }x);
+ iseq($^R,'last regexp code result');
+ }
+ iseq($^R,'Nothing');
+}
# Test counter is at bottom of file. Put new tests above here.
#-------------------------------------------------------------------
or print "# Unexpected outcome: should pass or crash perl\n";
{
+ local $Message = "substituation with lookahead (possible segv)";
$_="ns1ns1ns1";
s/ns(?=\d)/ns_/g;
iseq($_,"ns_1ns_1ns_1");
# Put new tests above the dotted line about a page above this comment
# Don't forget to update this!
-BEGIN { print "1..1349\n" };
+BEGIN { print "1..1358\n" };
}
require './test.pl';
-plan( tests => 133 );
+plan( tests => 134 );
$x = 'foo';
$_ = "x";
($c = "\x20\x00\x30\x01\x40\x1A\x50\x1F\x60") =~ s/[\x00-\x1f]//g;
is($c, "\x20\x30\x40\x50\x60", "s/[\\x00-\\x1f]//g");
}
+TODO:{
+ local $TODO = "RT#6006 needs resolution";
+ $TODO=$TODO;
+ $_ = "xy";
+ no warnings 'uninitialized';
+ /(((((((((x)))))))))(z)/; # clear $10
+ s/(((((((((x)))))))))(y)/${10}/;
+ is($_,"y","RT#6006: \$_ eq '$_'");
+}