Michael G Schwern wrote:
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.

It's worded as if the description were a name rather than a description. I like keeping the message the same, and moving the description somewhere after the "Failed..." message:


> /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)
> #     'During this is a really long name and its pretty long you see'
> #          got: '42'
> #     expected: '23'
> # Looks like you failed 2 tests of 2.


Should there be a way to turn on/off the description? A higher verbosity level? I can't think of a reason for it, but...


Randy.


Reply via email to