Re: [tap] "ok 1 description" vs "ok 1 - description"

Michael G Schwern <schwern@pobox.com> Sat, 31 January 2009 23:41 UTC

Return-Path: <tap-bounces@ietf.org>
X-Original-To: tap-archive@ietf.org
Delivered-To: ietfarch-tap-archive@core3.amsl.com
Received: from [127.0.0.1] (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 90BF33A67D1; Sat, 31 Jan 2009 15:41:29 -0800 (PST)
X-Original-To: tap@core3.amsl.com
Delivered-To: tap@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id D1B473A6834 for <tap@core3.amsl.com>; Sat, 31 Jan 2009 15:41:28 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.455
X-Spam-Level:
X-Spam-Status: No, score=-2.455 tagged_above=-999 required=5 tests=[AWL=0.144, BAYES_00=-2.599]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Pfqmj6sDW7Mj for <tap@core3.amsl.com>; Sat, 31 Jan 2009 15:41:27 -0800 (PST)
Received: from sasl.smtp.pobox.com (a-sasl-fastnet.sasl.smtp.pobox.com [207.106.133.19]) by core3.amsl.com (Postfix) with ESMTP id C4E753A67D1 for <tap@ietf.org>; Sat, 31 Jan 2009 15:41:25 -0800 (PST)
Received: from localhost.localdomain (unknown [127.0.0.1]) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTP id A743C951EA; Sat, 31 Jan 2009 18:41:05 -0500 (EST)
Received: from [10.23.42.2] (unknown [69.64.236.3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTPSA id 7DF9C951E7; Sat, 31 Jan 2009 18:41:03 -0500 (EST)
Message-ID: <4984E18D.7000606@pobox.com>
Date: Sat, 31 Jan 2009 15:41:01 -0800
From: Michael G Schwern <schwern@pobox.com>
User-Agent: Thunderbird 2.0.0.19 (Macintosh/20081209)
MIME-Version: 1.0
To: Steffen Schwigon <ss5@renormalist.net>
References: <497A77D0.8070500@pobox.com> <335014.20536.qm@web65715.mail.ac4.yahoo.com> <20090124115427.GC9114@pjcj.net> <87vds4podb.fsf@renormalist.net> <497B8530.4080903@pobox.com> <873aezxgen.fsf@renormalist.net>
In-Reply-To: <873aezxgen.fsf@renormalist.net>
X-Enigmail-Version: 0.95.7
X-Pobox-Relay-ID: A09BA342-EFF0-11DD-B098-CC4CC92D7133-02258300!a-sasl-fastnet.pobox.com
Cc: tap@ietf.org
Subject: Re: [tap] "ok 1 description" vs "ok 1 - description"
X-BeenThere: tap@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: Test Anything Protocol WG discussions <tap.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/tap>, <mailto:tap-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/pipermail/tap>
List-Post: <mailto:tap@ietf.org>
List-Help: <mailto:tap-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/tap>, <mailto:tap-request@ietf.org?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: tap-bounces@ietf.org
Errors-To: tap-bounces@ietf.org

Steffen Schwigon wrote:
>> Seeing as how Test::More is the widest producer of TAP, and it's
>> being doing "ok 1 - description" for years now, and that the dash
>> is optional so nothing is being made illegal, all of the above
>> would seem to actually be an argument in favor of adding the
>> optional dash to the grammar as it better describes reality.
>>
>> And it produces a nicer to read TAP moving forward, which is
>> important, too.
> 
> I see that the dash was meant optional for TAP. Maybe the
> optionality of the dash changed in TAP::Parser 3? Admittedly, I
> didn't try.

The last version of Test::Harness 2 before TAP::Parser strips the dash if its
there, you can see the code in Test::Harness::Point->from_test_line().
http://cpansearch.perl.org/src/PETDANCE/Test-Harness-2.64/lib/Test/Harness/Point.pm

But earlier versions of TH2 do not.

TAP::Parser (aka Test::Harness 3) does not strip the dash.

So we've already got some waffling around how the description is handled.  We
survived with hardly anyone noticing.


>> As a point of reference, we are discussing the grammar exactly
>> because we're trying to write down reality.
> 
> I see. But wasn't the original plan to write down what the only
> existing consumer toolchain aka. TAP::Parser does, because else no
> one in the world has a toolchain?

What the existing consumers and producers do is being written down.  Within
that limit, the human readability and machine parsability of TAP and its
ability to extend in the future are being protected.

Presumably the consumers and producers are in sync, but in the case of the
description Test::More and TAP::Parser aren't.  Test::More intends it to be
stripped, TAP::Parser doesn't do the stripping.  Nobody really uses it for
anything but human readable display, and they probably strip as to their
preference, so it hasn't been a big deal.

It's important to remember that TAP::Parser was written based on what
Test::Harness 2, Test::More and Test.pm do.  Test::More was written based on
what Test::Harness 1 and Perl's core t/TEST TAP parser handled.  Test::Harness
1 was written based on t/TEST which was written to support the Perl core
tests.  Parsers effect consumers, consumers effect parsers.

TAP::Parser was the first attempt to try and make sense of all that historical
cruft from scratch, and this is the first attempt to formalize it.  I'd like
to not just enshrine whatever it is we're doing at the moment we write the
draft and actually put some thought into it.

As mentioned before, the interpretation of the description is open to some
interpretation because it's just an identifier for the human.  It doesn't
effect pass or fail.  For one legacy parser to interpret it as "- foo" and
another to say "foo" doesn't make much difference.  Going forward is what does.

In addition, the existence of the dash removes some ambiguities.  How is this
interpreted?

ok 1      foo

Is that "foo" or "     foo"?  Its an open question.  Because of the tendency
of TAP::Parser to use \s+ (ie. one or more whitespace characters) to separate
tokens it's probably interpreted as "foo".  I doubt that was by design but
rather an expedient way to write the regexes.  If we just went with what
TAP::Parser does we'd be left with no way to have a machine readable leading
space in a description.

As another example, some people like to indent sub tests.  Without a dash it
would come out like this:

ok 1 thing() didn't blow up
ok 2   it returned the right thing
ok 3   they lived happily ever after

Do we count the leading spaces as part of the description?  The dash removes
this ambiguity.

ok 1 - thing() didn't blow up
ok 2 -   it returned the right thing
ok 3 -   they lived happily ever after

The details of how a description is handled has a lot ambiguity and wiggle
room both in current implementation and in definition.  It is not yet boxed in
by what TAP::Parser currently does.


-- 
I am somewhat preoccupied telling the laws of physics to shut up and sit down.
	-- Vaarsuvius, "Order of the Stick"
           http://www.giantitp.com/comics/oots0107.html
_______________________________________________
tap mailing list
tap@ietf.org
https://www.ietf.org/mailman/listinfo/tap