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: 4232
Status: resolved
Priority: 0/
Queue: Test-Simple

People
Owner: Nobody in particular
Requestors: Marek.Rouchal [...] gmx.net
sherzodr [...] handalak.com
Cc: sherzodr [...] cpan.org
AdminCc:

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



Subject: Use of uninitialized value in pattern match (m//) at Test/Builder.pm 292
Distribution: Test-Simple-0.47 My Perl version: 5.6.1 OS: Linux I see that the code is testing weather $name is defined or not, but I still keep getting the above warning "diagnostics" pragma is enabled. The line that produces the above warning is: ok(defined($article->id) ? 0 : 1 , $article->id); where $article->id is expected to return "undef". I'm not sure what's wrong with the code in Test/Builder.pm (line 292), but following seems to fix it: diff -u -r1.1.1.1 Builder.pm --- lib/Test/Builder.pm 6 Sep 2003 23:33:51 -0000 1.1.1.1 +++ lib/Test/Builder.pm 6 Sep 2003 23:52:57 -0000 @@ -289,6 +289,7 @@ lock $Curr_Test; $Curr_Test++; + $name ||= ""; $self->diag(<<ERR) if defined $name and $name =~ /^[\d\s]+$/; You named your test '$name'. You shouldn't use numbers for your test names. Very confusing.
[SHERZODR - Sat Sep 6 19:53:58 2003]: Show quoted text
> I see that the code is testing weather $name is defined or not, but I > still keep getting the above warning "diagnostics" pragma is enabled.
I can't reproduce this warning using a simple code snippet. What was the complete warning, with line and file number? Can you slash it down to a short program which reproduces the problem and post it? Show quoted text
> I'm not sure what's wrong with the code in Test/Builder.pm (line 292), > but following seems to fix it:
Before applying this, I'd like to be able to reproduce the problem and know if this is Perl's or Test::Builder's fault.
Subject: Test::Builder and ithreads
CC: SHERZODR [...] cpan.org
I found a solution (i.e., a workaround) for the failure in the test of Class::PObject [cpan #4218], related to Test::Builder. My config: perl-5.8.1/ithreads/sharedlibperl, gcc-3.1.1, Solaris 7/Sparc Here is the diff: --- /opt/perl_5.8.1/share/lib/Test/Builder.pm.orig 2003-10-29 08:47:41.581803000 +0100 +++ /opt/perl_5.8.1/share/lib/Test/Builder.pm 2003-10-29 08:47:51.790803000 +0100 @@ -301,6 +301,7 @@ my $out; my $result = {}; share($result); + share($name); unless( $test ) { $out .= "not ";
From: marek.rouchal [...] infineon.com
To: bug-Test-Simple [...] rt.cpan.org
CC: mschwern [...] cpan.org, sherzodr [...] cpan.org
Subject: RE: [cpan #4232] AutoReply: Test::Builder and ithreads
Date: Thu, 30 Oct 2003 11:56:41 +0100
RT-Send-Cc:
I have an even better patch for Test::Builder now; the problems in the test of Class::PObject happen because ok($test, $name) was passed an object as $name; and share($name) does evil things to the reference and its contents; so I put an explicit stringify in, which nicely did the trick for all of the Class::PObject tests. Whether passing an object as $name is sensible is a different story. Best regards, Marek --- /opt/perl_5.8.1/share/lib/Test/Builder.pm.orig 2003-10-29 08:47:41.581803000 +0100 +++ /opt/perl_5.8.1/share/lib/Test/Builder.pm 2003-10-30 11:51:05.083813000 +0100 @@ -289,8 +289,13 @@ lock $Curr_Test; $Curr_Test++; - $self->diag(<<ERR) if defined $name and $name =~ /^[\d\s]+$/; - You named your test '$name'. You shouldn't use numbers for your test names. + # some specialists put objects in $name, + # so we better stringify before the share() + my $name_s = defined $name ? "$name" : undef; + share($name_s); + + $self->diag(<<ERR) if defined $name_s and $name_s =~ /^[\d\s]+$/; + You named your test '$name_s'. You shouldn't use numbers for your test names. Very confusing. ERR @@ -313,10 +318,10 @@ $out .= "ok"; $out .= " $Curr_Test" if $self->use_numbers; - if( defined $name ) { - $name =~ s|#|\\#|g; # # in a name can confuse Test::Harness. - $out .= " - $name"; - $result->{name} = $name; + if( defined $name_s ) { + $name_s =~ s|#|\\#|g; # # in a name can confuse Test::Harness. + $out .= " - $name_s"; + $result->{name} = $name_s; } else { $result->{name} = '';
[MSCHWERN - Wed Sep 10 21:49:33 2003]: Show quoted text
> [SHERZODR - Sat Sep 6 19:53:58 2003]:
> > I see that the code is testing weather $name is defined or not, but
> I
> > still keep getting the above warning "diagnostics" pragma is
> enabled. > > I can't reproduce this warning using a simple code snippet. What was > the complete > warning, with line and file number? Can you slash it down to a short > program which > reproduces the problem and post it? > >
> > I'm not sure what's wrong with the code in Test/Builder.pm (line
> 292),
> > but following seems to fix it:
> > Before applying this, I'd like to be able to reproduce the problem and > know if this is > Perl's or Test::Builder's fault.
This is only a problem if the undef is a result of string overloading. Solving 4232 will solve this.