--- chromatic <[EMAIL PROTECTED]> wrote:
> (and displaying better diagnostics on success or failure), here's a
> small patch to Test::Harness::Straps to collect the diagnostic
> information currently dumped to STDERR and to store it in the test
> data structure for Straps users to collect:

OK, I have to admit that I'm rather confused by this patch.

This line:

> +    elsif ($result{number} and my $extra = $self->_is_extra_line(
> $line ))

Always fails to collect the data I need because $result{number} is
false when the extra data is being accumulated.  Thus, I changed it to:

  elsif (!$result{number} and my $extra = $self->_is_extra_line($line))

And this sub:  
> +sub _is_extra_line
> +{
> +    my ($self, $line, $test) = @_;
> +    return if index( $line, '# Looks like you failed' ) == 0;
> +    $line =~ s/^#//;
> +    return $line;
> +}

Doesn't need the $test and I needed the "got/expected" information,
leaving me with:

  sub _is_extra_line {
    my ($self, $line) = @_;
    return unless '#' eq substr $line, 0, 1;
    $line = substr $line, 1;
    return $line;
  }

And my colored test output now looks like this:

 * File 'sometest.t'
 * Expected 4 / Seen 4 / Okay 3 / Failed 1

       ok    1 - a good test
       ok    2 - useless, but still a good test
 * not ok    3 - and this is a forced failure
 *      Failed test (sometest.t at line 8)
 *           got: '2'
 *      expected: '3'
       ok    4 - and this one is just obvious
    Looks like you failed 1 tests of 4.

With the caveat that the asterisks at the front of the lines don't
really exist, but those lines are the ones that are colored bold red in
my output.

The rest of the patch was fine and I thank you very much!

Cheers,
Ovid

=====
If this message is a response to a question on a mailing list, please send
follow up questions to the list.

Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/

Reply via email to