yaml / yaml-test-suite

Comprehensive, language independent Test Suite for YAML
MIT License
172 stars 58 forks source link

Mention YAML 1.1 backwards incompatible cases #32

Closed asomov closed 6 years ago

asomov commented 6 years ago

Add info when a test case is backwards incompatible with 1.1

perlpunk commented 6 years ago

In YAML 1.1 also every node has to be indented by at least +1. See http://yaml.org/spec/1.1/#id903421 8.5.2. Block Nodes

[123]   ns-l+flow-in-block(n,c) ::= ns-flow-node(n+1,flow-out) s-l-comments
asomov commented 6 years ago

Well, I see it as a bug in spec. This is not allowed by [123] in YAML 1.1 but it is well supported by all the parsers:

seq: # - counts as indentation
- a
- b

The users will have to change the existing YAML documents when going to YAML 1.2 parser. That is why it should be known

perlpunk commented 6 years ago

Rule 123 is about flow nodes in block collections, not about block sequences in block collections.

asomov commented 6 years ago

It drives me crazy...

Still, the parsers I worked with, accept it. JS-YAML claims YAML 1.2 comtatibility and still accepts it. The change is merely a comment. Another request can improve the comment.

perlpunk commented 6 years ago

For block sequences in 1.1 see http://yaml.org/spec/1.1/#id931893

People read the “-” character as part of the indentation. Hence, block sequence entries
 require one less space of indentation, unless the block sequence is nested within
 another block sequence (hence the need for the block-in context and block-out context).

[197] seq-spaces(n,c) ::= c = block-out ⇒ n-1
                          c = block-in  ⇒ n
perlpunk commented 6 years ago

We are aware that unindented flow nodes are allowed in many processors. Even this is parsed:

foo:
  bar:
    baz: "a
b
c
d"
    boo: foo

Personally I think it shouldn't be allowed, and the spec doesn't allow it. IMHO it should stay in the test suite, and authors can simply choose to skip the tests they need to.

perlpunk commented 6 years ago

About changing the title of the test: We have several methods to add information to a test.

IMHO comments about 1.1, if we want to add them, should go into the plain text section.

My take on 1.1: We want to focus on 1.2 and above. The 1.1 spec has many flaws (even 1.2 has some), but the big Schema change in 1.2 and the lack of a test suite is probably what prevented authors from moving on to 1.2.

I started this wiki page for collecting differences between 1.1 and 1.2 https://github.com/yaml/yaml/wiki/YAML-1.2-Changelog, but I think it can never be complete because, like I mentioned, the 1.1 spec has flaws and nodbody wants to go completely through it for differences.

With the new test suite, implementing newer versions will be easier.