Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Does Data::Dumper give you eye strain? Use Test::More::is_deeply() for debugging!

by demerphq (Chancellor)
on Jul 20, 2005 at 18:39 UTC ( [id://476585]=note: print w/replies, xml ) Need Help??


in reply to Does Data::Dumper give you eye strain? Use Test::More::is_deeply() for debugging!

Try using Data::Dump::Streamer instead. Its much easier to read than DD is. Also, a newly released module called Test::Struct was put together explicitly to allow for testing fine grained differences which is_deeply() will not pick up. (Actually is_deeply is horribly named, it doesnt really do a deep comparison at all.)

---
$world=~s/war/peace/g

  • Comment on Re: Does Data::Dumper give you eye strain? Use Test::More::is_deeply() for debugging!

Replies are listed 'Best First'.
Re^2: Does Data::Dumper give you eye strain? Use Test::More::is_deeply() for debugging!
by ChemBoy (Priest) on Jul 20, 2005 at 20:37 UTC

    I'm not sure I quite agree that is_deeply doesn't do a deep comparison at all, though I agree that it has a quirk or two. But more to the point, what does Test::Struct offer that Test::Deep doesn't? Not meant rhetorically, I'm just curious, since they both seem to have the same basic goal.



    If God had meant us to fly, he would *never* have given us the railroads.
        --Michael Flanders

      I think I should leave that up to Fergal to answer, however its my understanding that what T::S does is different from what T::D does (I know for sure that the latter is considerably more flexible and attempts to solve problems that T::S doesnt and never will).

      Test::Struct was simply my attempt at making an is_deeply() that worked the way I expect it to. To save you reference to some very long and nasty perl-qa threads I'll simply say that as the author of the most accurate Perl Data serialization module currently on CPAN I found every other tool for testing insufficient for my purposes. Test::Struct is/was a prototype I wrote for the kind of testing I wished had been around for Data::Dump::Streamer. Some argue that this level of accuracy is only really useful for testing serialization modules but whatever. Anyway i wrote T::S just before i went on holiday (which im still on) so its in an alpha state right now, somethiong i plan to resolve when i return.

      ---
      $world=~s/war/peace/g

      TS is the strictest possible comparison that doesn't involve comparing reference addresses, so if $x=[];$y=[] then TS will say that [$x,$x] is not the same as [$x,$y] because one is an array with 2 refs to 1 array and the other has refs to 2 different arrays. This is a valid difference. TD ignores this difference. TD also lets you do something a little bit like regular expressions for data structures.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://476585]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-19 03:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found