( I'm going to be calling the YAML diagnostic syntax YAMLish and I
reckon this !!!! proposal should be called bang+ :)
On 17 Mar 2007, at 23:42, Michael G Schwern wrote:
Andy Armstrong wrote:
I'm still not clear what this notation provides that we can't do with
the new YAML machine readable diagnostic syntax. What are the
supposed
benefits? Concision?
Yeah, brevity. Pretty much. And human readability. YAML is
pretty good and
all but some text prefixed with some bangs is always going to be
easier to read.
OK, well it wouldn't be too hard to modify the YAMLish reader /
writer to handle this syntax too.
But I have to say I'm not 100% convinced. Weighing the (arguable)
readability advantage against the use of an established format (which
is still pretty readable) I think I come down on the YAML side. Of
course that might be because I've spent the last couple of days
writing the YAMLish reader / writer :)
[snip]
Also the messages are free-form and not associated with any
particular test.
Consider:
pass("this is a test");
notice("My hovercraft is full of eels.");
With the ! proposal it produces...
ok 1 - this is a test
!!!! My hovercraft is full of eels.
With YAML it produces...
ok 1 - this is a test
---
message: My hovercraft is full of eels.
severity: notice
...
Note how similar that is to:
pass("this is a test", { message => "My hovercraft is full of
eels." });
ok 1 - this is a test
---
message: My hovercraft is full of eels.
severity: pass
...
Though a parser should be able to tell the difference via the
severity I'm
worried this is shaving a bit too fine.
The general problem being that we don't know whether a YAML block is
associated with a test or is just a disassociated comment?
The way the parser is set up at the moment a YAML block is explicitly
associated with the preceding test result
( result yaml? )*
Each test has zero or one YAML blocks. I should add
( version yaml? )*
to the syntax rules to allow a YAML header document at the start of
the TAP too.
From the producer side I'm hoping to be able to come up with a clean
way of marshalling all the diagnostics associated with a particular
test and then outputting them as a single YAML document presumably
either just before the next test or at the end of the test run in the
case of the last test.
Obviously that means there's currently no way to express the idea of
a disassociated YAML block which is a point in favour of bang+. I can
certainly see the value in being able to do that.
[snip]
*psst* Remember to indent
not ok 1
---
message: WHOA! The fabric of the universe just broke down!
severity: fatal
...
I must have missed the rationale for indenting the YAML. What's that
about?
--
Andy Armstrong, hexten.net