Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test for {a: b?} #62

Open
perlpunk opened this issue Feb 21, 2020 · 6 comments
Open

Add a test for {a: b?} #62

perlpunk opened this issue Feb 21, 2020 · 6 comments

Comments

@perlpunk
Copy link
Member

According to HsYAML and the reference parser it is valid.
ruamel.yaml, NiMYAML, JS js-yaml, JS yaml, and YAML::PP parse it
libyaml, yaml-cpp, pyyaml, ruby psych don't

@perlpunk perlpunk added this to Backlog in Release Planning Feb 21, 2020
@ingydotnet
Copy link
Member

Related is {?a: b}. libyaml likes it and ref parser does not

@am11
Copy link
Contributor

am11 commented Feb 22, 2020

YamlDotNet does not like it either:

{a:b?}

+STR
+DOC
+MAP
=VAL :a

YamlDotNet.Core.SemanticErrorException: (Line: 1, Col: 6, Idx: 5) - (Line: 1, Col: 7, Idx: 6):
While parsing a flow mapping, did not find expected ',' or '}'.

However, {?a:b} is fine:

+STR
+DOC
+MAP
=VAL :a
=VAL :b
-MAP
-DOC
-STR

@am11
Copy link
Contributor

am11 commented Mar 14, 2020

(sorry for an off-topic question) what is the algorithm which generates the test codes (e..g 33X3)? Is there some encoding scheme for it or just (an unreserved) random string?

@perlpunk
Copy link
Member Author

@am11 the bin/new script can be used to create a new test.

cat /dev/urandom | LC_ALL=C tr -cd A-HJ-NP-Z2-9 | fold -w4 | grep [A-Z] | grep [0-9] | head -n1

@perlpunk perlpunk moved this from Backlog to In Progress/Review in Release Planning May 22, 2020
@perlpunk
Copy link
Member Author

In a107e87 I added https://github.com/yaml/yaml-test-suite/blob/master/test/JR7V.tml with several question-mark related tests.

@perlpunk
Copy link
Member Author

I think for {?a: b} there should be an extra issue. I would like to know why the reference parser and HsYAML think it's invalid, but I can't find in the spec why this should be invalid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Release Planning
  
In Progress/Review
Development

No branches or pull requests

3 participants