Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 27731
Status: resolved
Priority: 0/
Queue: Test-Deep

People
Owner: Nobody in particular
Requestors: dpisoni [...] cpan.org
Cc:
AdminCc:

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



Subject: Expose (somehow) output of deep_diag() after call to eq_deeply()
This ticket is similar in motive and substance to RT #27275 in Test::More: "Expose Test::Builder->_is_diag() as public method" For the motivation/use case, please read the above referenced ticket. Here is my horrible hack code for accomplishing what I want to accomplish. Essentially, I'm re-implementing eq_deeply() and capturing deep_diag() in an exception: _eq_deeply_with_fatal_diag( $results, $expected ); ... sub _eq_deeply_with_fatal_diag { my ($d1, $d2, $name) = @_; local $Test::Builder::Level = $Test::Builder::Level + 1; # Trust me, you want this. local $Test::Deep::Stack = Test::Deep::Stack->new; local $Test::Deep::CompareCache = Test::Deep::Cache->new; local %Test::Deep::WrapCache; my $ok = Test::Deep::descend( $d1, $d2 ) or die Test::Deep::deep_diag( $Test::Deep::Stack ); # here's the reason for this right here return $ok; } The fatal isn't necessary (it fits into the way I handle my data-driven tests), you could easily accomplish this by adding this to your eq_deeply(): return $ok ? $ok : wantarray ? ( $ok, deep_diag( $Test::Deep::Stack ) ) : $ok; Thanks for your consideration, David
Subject: Re: [rt.cpan.org #27731] Expose (somehow) output of deep_diag() after call to eq_deeply()
Date: Wed, 27 Jun 2007 19:52:11 +0100
To: bug-Test-Deep [...] rt.cpan.org
From: "Fergal Daly" <fergal [...] esatclear.ie>
I agree this should be exposed (my python version does exactly this) but I think I'd just use a different function name and return a ref to the stack array and the user can do whatever they like with it. I might get a chance to work on it this weekend but feel free to send me a function and some tests (tests are usually the large part of the work :).
v1.004 does this (will be on CPAN in a few hours).