On 02/09/07, Michael G Schwern <[EMAIL PROTECTED]> wrote:
> Fergal Daly wrote:
> 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.

I'm asking for somewhere in between. For Test::Tester what matters is
the public Test::Builder interface. Will you be adding an equivalent
to ->diag through which it is all funnelled? Test::Tester provides an
object which conforms to the T::B interface so I'd just need to
provide a new method if this was the plan.

I'm assuming here that test modules will provide these diagnostics in
a similar way to the old style, something like:

my $TB = Test::Builder->new()

sub my_test {
  blah();
  $TB->ok();
  if ($TB->can("verbose_diag") {
    $TB->verbose_diag({...});
  } else {
    $TB->diag(...);
  }
}

and just leave it up to T::B to check whether the harness supports
them or whether to format the info as an old-style diagnostic.

F

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

Reply via email to