diff options
author | Ævar Arnfjörð Bjarmason <avar@cpan.org> | 2014-06-21 17:44:20 +0000 |
---|---|---|
committer | Ævar Arnfjörð Bjarmason <avar@cpan.org> | 2014-06-21 17:58:43 +0000 |
commit | aaa63daea7f8ece57d84d8329754f95ea107301e (patch) | |
tree | 2723b291b86bd26f2190f99be6858157f2e08af1 /lib | |
parent | 43d7f0da895d00d0f557ad72549ddb3194763b55 (diff) | |
download | perl-aaa63daea7f8ece57d84d8329754f95ea107301e.tar.gz |
Make like() and unlike() in t/test.pl refuse non-qr// arguments
As I noted in v5.21.1-12-g826af13 we have subtle bugs in the test suite
because you can do e.g. like($@, '') now which'll be a passing test even
when we have an error, because $@ =~ // will be true.
I'm just changing t/test.pl to not accept non-Regexp arguments, and
fixing up a bunch of test failures that resulted from that. There might
still be more of these in tests that I'm just not running, I've also
changed some of these from $str =~ /foo/ to $str eq 'foo'
(i.e. s/like/is/) in cases where that appeared to work, but it might
break some systems.
Let's just find that out via the smokers.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/charnames.t | 4 | ||||
-rw-r--r-- | lib/overload.t | 2 | ||||
-rw-r--r-- | lib/perl5db.t | 8 |
3 files changed, 7 insertions, 7 deletions
diff --git a/lib/charnames.t b/lib/charnames.t index 5629f3a83c..bd0c21ea85 100644 --- a/lib/charnames.t +++ b/lib/charnames.t @@ -41,7 +41,7 @@ use charnames ":full"; 1 EOE - like($@, "above 0xFF", "Verify get warning for \\N{above ff} under 'use bytes' with :full"); + like($@, qr/above 0xFF/, "Verify get warning for \\N{above ff} under 'use bytes' with :full"); ok(! defined $res, "... and result is undefined"); $res = eval <<'EOE'; @@ -49,7 +49,7 @@ use charnames 'cyrillic'; "Here: \N{Be}!"; 1 EOE - like($@, "CYRILLIC CAPITAL LETTER BE.*above 0xFF", "Verify get warning under 'use bytes' with explicit script"); + like($@, qr/CYRILLIC CAPITAL LETTER BE.*above 0xFF/, "Verify get warning under 'use bytes' with explicit script"); ok(! defined $res, "... and result is undefined"); $res = eval <<'EOE'; diff --git a/lib/overload.t b/lib/overload.t index 7efd992fe8..d89ec2a510 100644 --- a/lib/overload.t +++ b/lib/overload.t @@ -305,7 +305,7 @@ is($na, '_!_xx_!_'); $na = 0; $na = eval { ~$aI }; -like($@, ''); +is($@, ''); bless \$x, OscalarI; diff --git a/lib/perl5db.t b/lib/perl5db.t index bd5615a673..0b777314fa 100644 --- a/lib/perl5db.t +++ b/lib/perl5db.t @@ -92,21 +92,21 @@ EOF { local $ENV{PERLDB_OPTS} = "ReadLine=0 NonStop=1"; my $output = runperl(switches => [ '-d' ], stderr => 1, progfile => '../lib/perl5db/t/rt-66110'); - like($output, "All tests successful.", "[perl #66110]"); + like($output, qr/\bAll tests successful\.$/, "[perl #66110]"); } # [ perl #116769] Frame=2 { local $ENV{PERLDB_OPTS} = "frame=2 nonstop"; my $output = runperl( switches => [ '-d' ], prog => 'print q{success}' ); is( $?, 0, '[perl #116769] frame=2 does not crash debugger, exit == 0' ); - like( $output, 'success' , '[perl #116769] code is run' ); + is( $output, 'success' , '[perl #116769] code is run' ); } # [ perl #116771] autotrace { local $ENV{PERLDB_OPTS} = "autotrace nonstop"; my $output = runperl( switches => [ '-d' ], prog => 'print q{success}' ); is( $?, 0, '[perl #116771] autotrace does not crash debugger, exit == 0' ); - like( $output, 'success' , '[perl #116771] code is run' ); + is( $output, 'success' , '[perl #116771] code is run' ); } # [ perl #41461] Frame=2 noTTY { @@ -114,7 +114,7 @@ EOF rc(''); my $output = runperl( switches => [ '-d' ], prog => 'print q{success}' ); is( $?, 0, '[perl #41461] frame=2 noTTY does not crash debugger, exit == 0' ); - like( $output, 'success' , '[perl #41461] code is run' ); + is( $output, 'success' , '[perl #41461] code is run' ); } package DebugWrap; |