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.

Compare what this hypothetical code might produce:

  notice("Attention.");
  notice("Attention.");
  notice("Testicles.");
  notice("That is all.");

!!!! Attention.
!!!! Attention.
!!!! Testicles.
!!!! That is all.

vs

  ---
  message:  Attention.
  severity: notice
  ...
  ---
  message:  Attention.
  severity: notice
  ...
  ---
  message:  Testicles.
  severity: notice
  ...
  ---
  message:  That is all.
  severity: notice
  ...

Of course you could be careful and put everything together in one notice()
call producing one YAML block but that's not always possible and "the user has
to be careful" is not a great way to start out a protocol.  The !!!! syntax
makes it unnecessary.

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.


> not ok 1
> ---
> message: Failed test in foo.t line 2
> severity: fail
> data:
>   expected: this
>   got: that
> ...
> ok 2
> ---
> message: WHOA! The fabric of the universe just broke down!
> severity: fatal
> ...

*psst* Remember to indent

not ok 1
  ---
  message:  WHOA! The fabric of the universe just broke down!
  severity: fatal
  ...

Reply via email to