--- demerphq <[EMAIL PROTECTED]> wrote:

> On 4/19/06, Ovid <[EMAIL PROTECTED]> wrote:
> > to handle got/expected failure information in Java or C?  There are
> > pretty rich data structures we could put out there and YAML might
> help.
> >  That would also likely simplify a parser.
> 
> If you mean you want pluck YAML test results from a noisy input
> stream I'd say youd probably be wrong.

I might agree with you, but only because what we currently have may not
be sufficient.  TAP essentially provides three types of information. 
The first is whether or not an individual test has passed.  The second
is the reason why a test has failed.  Those reasons are included in
lines beginning with a hash mark:

  ovid $ perl -MTest::More=tests,1 -e 'is 2,3, "fail"'
  1..1
  not ok 1 - fail
  #   Failed test 'fail'
  #   in -e at line 1.
  #          got: '2'
  #     expected: '3'
  # Looks like you failed 1 test of 1.

(The third type of information is human-readable "diag()" information
and I'll address those issues below)

There is a lot of potential here, but also problems.  First, "Failed
test 'fail' does not really indicate which tests fail (duplicate tests
names cause problems), so it's a human-readable bit of information, but
it's not useful for a parser.  It *is* useful for a parser if we
guarantee the error information is always after the failed test.

> I should think that youd have a much easier time using Data::Dumper
> and its ->Pad and ->Indent(0) method than you ever would with YAML.

That fails when we have PHP, C, or Java producing the information. 
They don't have Data::Dumper, but they do have YAML.

Another annoying issue is "diag()":

  ok foo(), 'foo() works';
  diag $some_message;
  ok bar(), 'bar() works';

For the above snippet, is diag() associated with the first test or the
second?

In reality, there's no way to guarantee that it's associated with
either, so what would you do with that diag() info when it pops up in a
JUnit style GUI test runner?

Further, we'll get real unhappy the first time when someone
drool-n-pastes the error output to diag statements:

  diag "   got: '2'";

>From a parser standpoint, there's no clean way of distinguishing that
from what the test functions are going to output.  As a result, I
really think that "diag" and normal test failure information should be
marked differently (instead of the /^# / that we see).

Thoughts?

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