develooper Front page | perl.perl5.porters | Postings from December 2013

[perl #120854] dist/Data-Dumper/t/dumper.t: Add descriptions to tests lacking them

Thread Next
From:
James E Keenan via RT
Date:
December 28, 2013 02:49
Subject:
[perl #120854] dist/Data-Dumper/t/dumper.t: Add descriptions to tests lacking them
Message ID:
rt-4.0.18-15889-1388198956-82.120854-15-0@perl.org
On Mon Dec 23 18:53:26 2013, jkeen@verizon.net wrote:

[snip]
> 
> This file uses a custom TEST() subroutine which essentially runs over 
> each input three times, printing out the description only in the first 
> of each block of three.  So the descriptions will be aimed principally 
> at letting someone debugging a problem know where in the test file she is.
> 
> Add descriptions to the invocations of TEST() currently lacking them.
> 
> I'll work on this in a branch.

Branch: smoke-me/jkeenan/120854-dumper-t

All 3-to-a-TEST blocks now have a description/name/label which prints out on the first of the three tests in each block.

As mentioned previously, my main motivation in taking this on was making sure that in the future, no one trying to debug a failure in this file has a tough time figuring out where in the file the failure occurred.  The descriptions I have provided are therefore primarily signposts.  If you can suggest better descriptions -- better in the sense that they more accurately describe what is going on in a particular test block -- I will gladly accept them.

There was one case where I changed what a test was doing in addition to providing a description.  At line 610 of dist/Data-Dumper/t/dumper.t in blead we have this block:

#####
  TEST q(
     $d = Data::Dumper->new( [\@dogs, \%kennel], [qw(*dogs *kennels)] );
     $d->Deepcopy(1)->Dump;
    );
  if ($XS) {
    TEST q($d->Reset->Dumpxs);
  }
#####

By the point I got to this block I had become very familiar with the syntax and style Gurusamy Sarathy was using in this file back in mid-1998.  This block struck me as a deviation from the norm.  Based on all the other blocks in the file, I would have expected to see this:

#####
  TEST q(
     $d = Data::Dumper->new( [\@dogs, \%kennel], [qw(*dogs *kennels)] );
     $d->Deepcopy(1)->Dump;
    );
  if ($XS) {
     $d = Data::Dumper->new( [\@dogs, \%kennel], [qw(*dogs *kennels)] );
     $d->Deepcopy(1)->Dumpxs;
  }
#####

In other words, I would have expected the 'if ($XS)' block to be spelled exactly like the first part of the block, except calling the Dumpxs method instead of Dump.

How then to explain this?

#####
    TEST q($d->Reset->Dumpxs);
#####

My hunch is that this is simply a copy-and-paste error that has gone undetected for fifteen years.  Why that hunch?  Because the test block immediately preceding the one cited above is this (starting at line 588 in blead):

#####
  TEST q($d->Reset->Dump);
  if ($XS) {
    TEST q($d->Reset->Dumpxs);
  }
#####

Based on this analysis, in my branch I have changed the second part of the block starting at line 610 to:

#####
  if ($XS) {
     $d = Data::Dumper->new( [\@dogs, \%kennel], [qw(*dogs *kennels)] );
     $d->Deepcopy(1)->Dumpxs;
  }
#####

... and then added descriptions.  If anyone believes that this was not a copy-and-paste error and that the current test is properly formulated, please let me know ASAP.

Thank you very much.
Jim Keenan

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=120854

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About