--- On Mon, 5/4/10, Gabor Szabo <szab...@gmail.com> wrote:

> From: Gabor Szabo <szab...@gmail.com>

> Maybe I need something like this:
> 
> $mech->content_like(qr{regex}) or do {
>     my $filename = 'some_filename';
>     if (open my $fh, '>', $filename) {
>         print $fh $mech->content;
>         diag "File: $filename";
>     }
> };
> 
> and then parse the TAP output for 'File:' *after* a test
> failure.
> 
> Is there a better way to do this?

The problem, I think, is that everyone wants subtly different things from tests 
outside of ok/not ok.  The question I'm wondering is what you mean by "this" in 
"is there a better way to do this?".  

Are you wanting a better way of presenting the filename to test 
authors/runners?  Are you wanting a better way to store the file contents?

If it's the former, we need structured diagnostics in TAP to be formalised and 
implemented.  If it's the latter, I would recommend writing your own "output to 
file" function and then instead of using "Test::More" and your own test 
utilities, bundle all of them with Test::Kit so you can just do this:

  use My::Custom::Test::More tests => $test_count;

The advantage here is that you have your own custom test behaviours nicely 
controlled by one module and if you need to change them, you can do so in one 
spot.

Or maybe you meant something else by "this" entirely :)

Cheers,
Ovid
--
Buy the book         - http://www.oreilly.com/catalog/perlhks/
Tech blog            - http://blogs.perl.org/users/ovid/
Twitter              - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6

Reply via email to