Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 38320
Status: resolved
Priority: 0/
Queue: Test-Differences

People
Owner: Nobody in particular
Requestors: CJONES [...] cpan.org
Cc: whynot [...] pozharski.name
AdminCc:

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



Subject: undef values in list
Very minor bug - when testing a list containing only undef values like so; eq_or_diff \@aList, [undef,undef,undef,undef], 'a list with undef values'; Test::Differences gives multiple warnings; "Use of uninitialized value in join or string at [path]/Test::Differences.pm line 364" The test passes, but the output looks untidy - there are two such warnings for each index, so a large list would produce a bit of a mess.
From: whynot [...] pozharski.name
On Fri Aug 08 07:19:21 2008, CJONES wrote: Show quoted text
> Very minor bug - when testing a list containing only undef values like > so; > > eq_or_diff \@aList, [undef,undef,undef,undef], 'a list with undef > values'; > > Test::Differences gives multiple warnings; > > "Use of uninitialized value in join or string at > [path]/Test::Differences.pm line 364" > > The test passes, but the output looks untidy - there are two such > warnings for each index, so a > large list would produce a bit of a mess. >
I think that happens because scalars in array-of-scalars aren't processed by trailing logic in B<_flatten>. For me that bug[1] doesn't trigger when test-script is run directly, only for C<./Build test>. Investigation in progress. [1] To maintainers: consider escalating this report as C<Important>.
From: whynot [...] pozharski.name
On Wed Dec 10 19:13:36 2008, whynot wrote: Show quoted text
> On Fri Aug 08 07:19:21 2008, CJONES wrote:
> > The test passes, but the output looks untidy - there are two such > > warnings for each index, so a > > large list would produce a bit of a mess. > >
> > I think that happens because scalars in array-of-scalars aren't > processed by trailing logic in B<_flatten>. > > For me that bug[1] doesn't trigger when test-script is run directly, > only for C<./Build test>. Investigation in progress. > > [1] To maintainers: consider escalating this report as C<Important>.
Bugfix in attach. And I insist -- that's not about noise and it's C<Important>.
diff -Nur Test-Differences-0.49_02.orig/lib/Test/Differences.pm Test-Differences-0.49_02/lib/Test/Differences.pm --- Test-Differences-0.49_02.orig/lib/Test/Differences.pm 2008-08-02 15:00:49.000000000 +0300 +++ Test-Differences-0.49_02/lib/Test/Differences.pm 2008-12-13 16:49:41.000000000 +0200 @@ -390,6 +390,10 @@ } } + for (@recs) { + $_ = '<undef>' unless defined + } + return \@recs; } diff -Nur Test-Differences-0.49_02.orig/t/20undef.t Test-Differences-0.49_02/t/20undef.t --- Test-Differences-0.49_02.orig/t/20undef.t 1970-01-01 03:00:00.000000000 +0300 +++ Test-Differences-0.49_02/t/20undef.t 2008-12-13 16:39:13.000000000 +0200 @@ -0,0 +1,36 @@ +# Composed from F<02pass.t> and F<10test.t> + +use strict; +use warnings; + +use Test::More; +use Test::Differences; + +my $warn_count; + +local $SIG{__WARN__} = sub { + $_[0] =~ m{uninitialized value in .+/Differences.pm}i and + $warn_count++; +}; + +my @r_tests = ( + sub { eq_or_diff [ 'a', '', 'b' ], [ 'a', '', 'b' ] }, + sub { eq_or_diff [ 'a', undef, 'b' ], [ 'a', undef, 'b' ] }, +); + +my @t_tests = ( + sub { eq_or_diff [ 'a', undef, 'b' ], [ 'a', '', 'b' ] }, + sub { eq_or_diff [ 'a', '', 'b' ], [ 'a', undef, 'b' ] }, +); +plan tests => @r_tests + @t_tests + 1; + +$_->() for @r_tests; + +diag "This test misuses TODO: these TODOs are actually real tests.\n"; + +TODO: { + local $TODO = 'Deliberate misuse of TODO'; + $_->() for @t_tests; +} + +ok !$warn_count;
This is fixed in the .60 release which should be on the CPAN soon. Thank you and my apologies for taking so long to fix this. Cheers, Ovid