Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

tomhukins (4457)

tomhukins
  (email not shown publicly)

Perl, Web, Database developer, and Milton Keynes Perl Monger [pm.org].

Journal of tomhukins (4457)

Tuesday March 17, 2009
09:50 AM

Using Test::Deep with Test::Builder

[ #38656 ]

I find Test::Deep very useful when writing tests. It's very handy for checking complicated data structures in all sorts of different ways.

Recently I wanted to use Test::Deep in my own Test::Builder test subclass. I discovered Test::Deep::NoTest which seemed useful: it lets me call functions from Test::Deep without them expecting to run directly within a test script themselves.

So, Test::Deep::NoTest and eq_deeply() looked like what I wanted. And they did a fine job, except when comparisons failed: I could find out that a comparison had failed, but not why.

After a brisk stroll through Test::Deep's source code and a quick chat with its author, I wrote a patch to expose and document its cmp_details() method. This lets you compare data structures and get a description of any differences, if they exist.

If you want to use Test::Deep within your own test class, download version 0.104 or newer of Test::Deep and see the new documentation on Using Test::Deep with Test::Builder.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.