Ryan King finally submitted to me a full patch to add the description to Test::Builder diagnostic output. Unfortunately I'm not hot on his formatting, however it has finally kicked my ass into examining the problem.
Just to refresh everyone, this is what the output of #!/usr/bin/perl -w use Test::More tests => 2; is(23, 42); is(42, 23, "this is a really long name and its pretty long you see"); looks like when run through Test::Harness right now. /Users/schwern/tmp/during....NOK 1 # Failed test (/Users/schwern/tmp/during.t at line 5) # got: '23' # expected: '42' /Users/schwern/tmp/during....NOK 2 # Failed test (/Users/schwern/tmp/during.t at line 6) # got: '42' # expected: '23' # Looks like you failed 2 tests of 2. The description is not seen. That description might contain extra information about what the test was doing. It might disambiguate from other tests on line 6, particularly if the test was run in a loop. So its important that it be seen. Here's Ryan's solution that got me started thinking. /Users/schwern/tmp/during....NOK 1 # Failed test (/Users/schwern/tmp/during.t at line 5) # got: '23' # expected: '42' /Users/schwern/tmp/during....NOK 2 # During this is a really long name and its pretty long you see # Failed test (/Users/schwern/tmp/during.t at line 6) # got: '42' # expected: '23' # Looks like you failed 2 tests of 2. This is what I morphed it into. /Users/schwern/tmp/during....NOK 1 # Failed test (/Users/schwern/tmp/during.t at line 5) # got: '23' # expected: '42' /Users/schwern/tmp/during....NOK 2 # Failed test "this is a really long name and its pretty long you see" # (/Users/schwern/tmp/during.t at line 6) # got: '42' # expected: '23' I'm pretty happy with that but I'd like feedback. I've attached the patch so folks can play around with it. Let me know what you think. -- Michael G Schwern [EMAIL PROTECTED] http://www.pobox.com/~schwern ROCKS FALL! EVERYONE DIES! http://www.somethingpositive.net/sp05032002.shtml
=== lib/Test/Builder.pm ================================================================== --- lib/Test/Builder.pm (revision 4504) +++ lib/Test/Builder.pm (local) @@ -448,7 +448,14 @@ unless( $test ) { my $msg = $todo ? "Failed (TODO)" : "Failed"; $self->_print_diag("\n") if $ENV{HARNESS_ACTIVE}; - $self->diag(" $msg test ($file at line $line)\n"); + + if( defined $name && $ENV{HARNESS_ACTIVE} ) { + $self->diag(qq[ $msg test "$name"\n]); + $self->diag(qq[ ($file at line $line)\n]); + } + else { + $self->diag(" $msg test ($file at line $line)\n"); + } } return $test ? 1 : 0;