I mentioned YAML with a pretense I failed to mention -- that we
wouldn't parse the YAML. That's already been done, and there are
plenty of parsers.

YAML has clear designations of where it starts and ends. A TAP parser
wouldn't have to look at the diagnostics and guess what it is.

If the data structure is limited to MIME-like key/value pairs, many
people will do their own marshalling anyway. Why not give them that
power from the start?

Maybe we don't care. Maybe we can simply add a callback for some
diagnostic_block_analyzer() and, in my own little happy world,

 $parser->diagnostic_block_analyzer( sub {
   my ($block) = @_;
   if ($block =~ m{ \A --- }xs) {
     do something with YAML::Load($block);
   }
   else {
     do something else
   }
 });

On 7/11/06, Adam Kennedy <[EMAIL PROTECTED]> wrote:
Whoa whoa whoa slow down there folks...

Some people seemed to have misrecognised those keys as YAML.

It was NEVER meant to be YAML.

The idea was to use something more like MIME headers.

We all agreed that we DIDN'T want the format to be too heavy, and going
with MIME or MIME-alike seemed the sweet spot in terms of ease of
parsing and standardization vs extensibility.

Having YAML in the TAP spec would complicate things greatly, especially
as the YAML spec includes things like multi-line strings. And it would
mean that we'd have to deal with YAML error events, JSON-style parsing
and a bunch of other things that are problematic.

It's NOT ease to parse at all, not compared to the current relative
simplicity of TAP at the moment.

Adam K

Jonathan T. Rockway wrote:
>>  not ok 2 - omg t3h sooper test!!1!
>>  --- TAP diagnostics
>>  file:        foo.t
>
>
> Why aren't we commenting the YAML block so that it's compatible with
> current TAP parsers?  I'm thinking something like this:
>
> not ok 2 - ensure that foo is equal to bar
> # --- !!tap/diagnostics
> # file: foo.t
> # line: 42
> # got:
> #      - !!perl/foobar
> #          key: value
> # expected:
> #      - !!perl/foobar
> #         key: ~
> # etc: (and so on)
>
> The commented section is raw YAML goodness, AND this format is
> compatible with current TAP parsers.  I'm liking this a lot, especially
> since I can use it Right Now (tm) by doing diag(Dump($data)).
>
> Any reason this shouldn't be the standard? It's easy to parse, it's easy
> to read.
>
> Would it be acecptable if I patched Test::More to start outputing it's
> expected/got messages in YAML instead of a plain text format?
>
> Regards,
> Jonathan Rockway



--
Ian Langworth

Reply via email to