4

A comprehensive test suite would be a valuable tool to have, especially when evaluating all of the variant parsers out there. Does such a beast exist?

In a perfect world, I imagine it would have different sections for different versions of the YAML spec...

djsadinoff
  • 5,519
  • 6
  • 33
  • 40
  • This started as a question about a particular case for a particular set of parsers, but I thought I'd broaden things... – djsadinoff Oct 07 '15 at 21:49
  • 1
    The PyYAML source has a quite extensive test system for testing each stage of the the parsing and generation against many parts of the (1.1) specification. – Anthon Oct 07 '15 at 22:10
  • I thought I'd get JSON+comments for free by specifying YAML as an interop language, but if something as basic as JSON+comments is tripping up common libraries, than forget it. e.g. php's Symfony YAML parser chokes on http://pastebin.com/R8GzNpwC but other parser/validators say it's fine. It's probably fine, but why should I have to wonder? – djsadinoff Oct 07 '15 at 22:22
  • That is legal YAML, you can have comments even in flow style. My parser (ruamel.yaml) parses it without problem, although the comments are lost on round-tripping (which wouldn''t happen when it is a block mapping). File a bug. Use a better parser if available for PHP, switch languages if you can. Or preprocess in an external process is my recommendation (ping me if you put up a question on how to do that). – Anthon Oct 08 '15 at 05:50

1 Answers1

5

There is currently one in the making, see here.

We also generate a result matrix for YAML implementations which

  • we know of
  • are written in a language we know so we can implement adapter code to validate the test suite against it

Full disclosure: I am the author of NimYAML and some of the test cases and adapters.

flyx
  • 35,506
  • 7
  • 89
  • 126