Fergal Daly wrote:
>>   diagnostic( {
>>     found   => $found,   # can be stand-alone
>>     wanted  => $wanted,  # must always be present with 'found'
>>     display => $display, # optional human-readable presentation
>>     extra   => $extra,   # anything else. Useful for custom harnesses
>>     meta    => 0,
>>   } );
> 
> [resending, I forgot reply-all last time]
> 
> How does this info get out into the stream. I presume it's not through
> Test::Builder->diag() otherwise it would have "#"s prepended. I ask
> because Test::Tester tries as much as possible to deal with the raw
> data _before_ it has been serialised. So if I get around to adding
> support for the fancy new diagnostics it would be really nice to have
> access to hashref and not have to deal with the YAML at all,

It goes out via the normal TAP stream with all the "ok" and "not ok".  That
is, STDOUT.

Or are you asking about the guts of Test::Builder?  I haven't planned it out
much but I'm thinking something like...

        # Get the Test::Builder::Diagnostics object.
        my $diagnostics = $tb->diagnostics_object;

        # Hand it the hash and return the YAML
        my $tap_diagnostics = $diagnostics->format_diagnostics({
                found  => $got,
                wanted => $expected
        });

        # Print it to the TAP stream.
        $tb->_print($tap_diagnostics);

So you should be able to drop in your own Test::Builder::Diagnostics object
which captures the hash.


-- 
Stabbing you in the face so you don't have to.

Reply via email to