Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-Simple CPAN distribution.

Report information
The Basics
Id: 15654
Status: resolved
Priority: 0/
Queue: Test-Simple

People
Owner: Nobody in particular
Requestors: perl [...] bsod.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Date: Wed, 9 Nov 2005 09:37:05 -0600 (CST)
From: Pete Krawczyk <perl [...] bsod.net>
To: perl-qa [...] perl.org
CC: bug-Test-Simple [...] rt.cpan.org
Subject: Test-Simple patch: can_ok() fails if first argument is false
Download (untitled) / with headers
text/plain 1.5k
The following Perl gives Test::More 0.60 and 0.62 heartache: $ perl -MTest::More=tests,1 -we'can_ok(undef,undef)' 1..1 Use of uninitialized value in concatenation (.) or string at .../5.8.6/Test/More.pm line 501. Use of uninitialized value in concatenation (.) or string at .../5.8.6/Test/More.pm line 501. not ok 1 - ->can('') # Failed test (-e at line 1) Use of uninitialized value in concatenation (.) or string at .../5.8.6/Test/More.pm line 506. Use of uninitialized value in concatenation (.) or string at .../5.8.6/Test/More.pm line 506. # ->can('') failed # Looks like you failed 1 test of 1. $ The following patch makes Test::More verify the class isn't false first. ========================================================================== diff -ur Test-Simple-0.62/lib/Test/More.pm Test-Simple-0.62-patched/lib/Test/More.pm --- Test-Simple-0.62/lib/Test/More.pm 2005-10-08 01:56:17.000000000 -0500 +++ Test-Simple-0.62-patched/lib/Test/More.pm 2005-11-09 09:22:44.000000000 -0600 @@ -465,6 +465,12 @@ my $class = ref $proto || $proto; my $tb = Test::More->builder; + unless( $class ) { + my $ok = $tb->ok( 0, "->can(...)" ); + $tb->diag(' can_ok() called with empty class or reference'); + return $ok; + } + unless( @methods ) { my $ok = $tb->ok( 0, "$class->can(...)" ); $tb->diag(' can_ok() called with no methods'); ========================================================================== The patch does not address a method name that is undefined. -Pete K -- Pete Krawczyk perl at bsod dot net
Download (untitled) / with headers
text/plain 1.7k
Patch applied to subversion repository by Richard Foley. On Wed Nov 09 10:37:37 2005, perl@bsod.net wrote: Show quoted text
> The following Perl gives Test::More 0.60 and 0.62 heartache: > > $ perl -MTest::More=tests,1 -we'can_ok(undef,undef)' > 1..1 > Use of uninitialized value in concatenation (.) or string at > .../5.8.6/Test/More.pm line 501. > Use of uninitialized value in concatenation (.) or string at > .../5.8.6/Test/More.pm line 501. > not ok 1 - ->can('') > # Failed test (-e at line 1) > Use of uninitialized value in concatenation (.) or string at > .../5.8.6/Test/More.pm line 506. > Use of uninitialized value in concatenation (.) or string at > .../5.8.6/Test/More.pm line 506. > # ->can('') failed > # Looks like you failed 1 test of 1. > $ > > The following patch makes Test::More verify the class isn't false > first. > >
======================================================================= === Show quoted text
> diff -ur Test-Simple-0.62/lib/Test/More.pm Test-Simple-0.62- > patched/lib/Test/More.pm > --- Test-Simple-0.62/lib/Test/More.pm 2005-10-08 01:56:17.000000000 > -0500 > +++ Test-Simple-0.62-patched/lib/Test/More.pm 2005-11-09 > 09:22:44.000000000 -0600 > @@ -465,6 +465,12 @@ > my $class = ref $proto || $proto; > my $tb = Test::More->builder; > > + unless( $class ) { > + my $ok = $tb->ok( 0, "->can(...)" ); > + $tb->diag(' can_ok() called with empty class or > reference'); > + return $ok; > + } > + > unless( @methods ) { > my $ok = $tb->ok( 0, "$class->can(...)" ); > $tb->diag(' can_ok() called with no methods'); >
======================================================================= === Show quoted text
> > The patch does not address a method name that is undefined. > > -Pete K
-- http://www.rfi.net
Including matching fail-more.t test. -- http://www.rfi.net


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.