# YAML Test Matrix

--- &test-CVW2
  Title: Invalid comment after comma
  Tags: [ comment, error, flow, sequence ]

YAML

---
[ a, b, c,#invalid
]

Expected Events

+STR
+DOC ---
+SEQ
=VAL :a
=VAL :b
=VAL :c

Expected JSON



c-libyaml-event

 invalid_incorrect
+STR
+DOC ---
+SEQ []
=VAL :a
=VAL :b
=VAL :c
-SEQ
-DOC
-STR

cpp-yamlcpp-event

 invalid_incorrect
+STR
+DOC
+SEQ []
=VAL :a
=VAL :b
=VAL :c
-SEQ
-DOC
-STR

java-snakeyaml-event

 invalid_incorrect
+STR
+DOC ---
+SEQ []
=VAL :a
=VAL :b
=VAL :c
-SEQ
-DOC
-STR

java-snakeyaml-json

 invalid_incorrect
[
  "a",
  "b",
  "c"
]

js-jsyaml-json

 invalid_incorrect
["a","b","c"]

lua-lyaml-json

 invalid_incorrect
["a","b","c"]

nim-nimyaml-event

 invalid_incorrect
+STR
+DOC ---
+SEQ
=VAL :a
=VAL :b
=VAL :c
-SEQ
-DOC
-STR

perl-pplibyaml-event

 invalid_incorrect
+STR
+DOC ---
+SEQ []
=VAL :a
=VAL :b
=VAL :c
-SEQ
-DOC
-STR

perl-pplibyaml-json

 invalid_incorrect
[
   "a",
   "b",
   "c"
]

perl-pplibyaml-perl

 invalid_incorrect
[
  'a',
  'b',
  'c'
]

perl-syck-json

 invalid_incorrect
[
   "a",
   "b",
   "c,#invalid"
]

perl-syck-perl

 invalid_incorrect
[
  'a',
  'b',
  'c,#invalid'
]

perl-xs-json

 invalid_incorrect
[
   "a",
   "b",
   "c"
]

perl-xs-perl

 invalid_incorrect
[
  'a',
  'b',
  'c'
]

py-pyyaml-event

 invalid_incorrect
+STR
+DOC ---
+SEQ []
=VAL :a
=VAL :b
=VAL :c
-SEQ
-DOC
-STR

py-pyyaml-json

 invalid_incorrect
[
  "a",
  "b",
  "c"
]

py-pyyaml-py

 invalid_incorrect
['a', 'b', 'c']

py-ruamel-event

 invalid_incorrect
+STR
+DOC ---
+SEQ []
=VAL :a
=VAL :b
=VAL :c
-SEQ
-DOC
-STR

py-ruamel-json

 invalid_incorrect
[
  "a",
  "b",
  "c"
]

py-ruamel-py

 invalid_incorrect
['a', 'b', 'c']

ruby-psych-json

 invalid_incorrect
["a","b","c"]

c-libfyaml-event

 invalid_correct
stdin:2:11: error: invalid comment after comma
[ a, b, c,#invalid
          ^
[NOT]: fy_fetch_flow_collection_entry() failed
[NOT]: fy_fetch_tokens() failed
[NOT]: failed to peek token
+STR
+DOC ---

c-libfyaml-json

 invalid_correct
stdin:2:11: error: invalid comment after comma
[ a, b, c,#invalid
          ^
[NOT]: fy_fetch_flow_collection_entry() failed
[NOT]: fy_fetch_tokens() failed
[NOT]: failed to peek token

dotnet-yamldotnet-event

 invalid_correct
Unhandled exception. YamlDotNet.Core.SemanticErrorException: (Line: 2, Col: 10, Idx: 13) - (Line: 2, Col: 11, Idx: 14): While parsing a flow sequence, did not find expected ',' or ']'.
   at YamlDotNet.Core.Parser.ParseFlowSequenceEntry(Boolean isFirst)
   at YamlDotNet.Core.Parser.StateMachine()
   at YamlDotNet.Core.Parser.MoveNext()
   at YamlDotNet.RepresentationModel.LibYamlEventStream.WriteTo(TextWriter textWriter)
   at Program.Main(String[] commandLineArguments)
Aborted (core dumped)
+STR
+DOC ---
+SEQ
=VAL :a
=VAL :b
=VAL :c

dotnet-yamldotnet-json

 invalid_correct
Unhandled exception. YamlDotNet.Core.SemanticErrorException: (Line: 2, Col: 10, Idx: 13) - (Line: 2, Col: 11, Idx: 14): While parsing a flow sequence, did not find expected ',' or ']'.
   at YamlDotNet.Core.Parser.ParseFlowSequenceEntry(Boolean isFirst)
   at YamlDotNet.Core.Parser.StateMachine()
   at YamlDotNet.Core.Parser.MoveNext()
   at YamlDotNet.Core.ParserExtensions.TryConsume[T](IParser parser, T& event)
   at YamlDotNet.Serialization.NodeDeserializers.ScalarNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func`3 nestedObjectDeserializer, Object& value)
   at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
   at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
   at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.<>c__DisplayClass3_0.<DeserializeValue>b__0(IParser r, Type t)
   at YamlDotNet.Serialization.NodeDeserializers.CollectionNodeDeserializer.DeserializeHelper(Type tItem, IParser parser, Func`3 nestedObjectDeserializer, IList result, Boolean canUpdate)
   at YamlDotNet.Serialization.NodeDeserializers.CollectionNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func`3 nestedObjectDeserializer, Object& value)
   at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
   at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
   at YamlDotNet.Serialization.Deserializer.Deserialize(IParser parser, Type type)
   at YamlDotNet.Serialization.Deserializer.Deserialize(TextReader input, Type type)
   at YamlDotNet.Serialization.Deserializer.Deserialize(TextReader input)
   at Program.Main(String[] commandLineArguments)
Aborted (core dumped)

hs-hsyaml-event

 invalid_correct
Parsing error near byte offset Pos {posByteOffset = 4, posCharOffset = 4, posLine = 2, posColumn = 0} (Lexical error near "[ a, b, c,#invalid")
+STR
+DOC ---
=VAL :

hs-hsyaml-json

 invalid_correct
hsyaml-parser: user error (Lexical error near "[ a, b, c,#invalid")

js-yaml-event

 invalid_correct
Comments must be separated from other tokens by white space characters at line 2, column 11:

[ a, b, c,#invalid
          ^^^^^^^^
+STR
+DOC ---
+SEQ
=VAL :a
=VAL :b
=VAL :c
-SEQ
-DOC
-STR

js-yaml-json

 invalid_correct
/yaml/bin/js-yaml-json:8
  if (doc.errors.length !== 0) throw doc.errors[0]
                               ^

YAMLParseError: Comments must be separated from other tokens by white space characters at line 2, column 11:

[ a, b, c,#invalid
          ^^^^^^^^

    at Composer.onError (/node/node_modules/yaml/dist/compose/composer.js:71:34)
    at Object.resolveProps (/node/node_modules/yaml/dist/compose/resolve-props.js:38:21)
    at Object.resolveFlowCollection (/node/node_modules/yaml/dist/compose/resolve-flow-collection.js:24:36)
    at Object.composeCollection (/node/node_modules/yaml/dist/compose/compose-collection.js:21:42)
    at Object.composeNode (/node/node_modules/yaml/dist/compose/compose-node.js:30:38)
    at Object.composeDoc (/node/node_modules/yaml/dist/compose/compose-doc.js:31:23)
    at Composer.next (/node/node_modules/yaml/dist/compose/composer.js:152:40)
    at next (<anonymous>)
    at Composer.compose (/node/node_modules/yaml/dist/compose/composer.js:134:25)
    at compose.next (<anonymous>)

perl-pp-event

 invalid_correct
Line      : 2
Column    : 11
Message   : Invalid plain scalar
Where     : /perl5/lib/perl5/YAML/PP/Lexer.pm line 366
YAML      : "#invalid"
  at /yaml/bin/perl-pp-event line 25.
+STR
+DOC ---
+SEQ []
=VAL :a
=VAL :b
=VAL :c

perl-pp-json

 invalid_correct
Line      : 2
Column    : 11
Message   : Invalid plain scalar
Where     : /perl5/lib/perl5/YAML/PP/Lexer.pm line 366
YAML      : "#invalid"
  at /perl5/lib/perl5/YAML/PP/Loader.pm line 94.

perl-pp-perl

 invalid_correct
Line      : 2
Column    : 11
Message   : Invalid plain scalar
Where     : /perl5/lib/perl5/YAML/PP/Lexer.pm line 366
YAML      : "#invalid"
  at /perl5/lib/perl5/YAML/PP/Loader.pm line 94.

perl-refparser-event

 invalid_correct
Parser finished before end of input at /perl5/lib/perl5/YAML/Parser.pm line 4047, <> line 1.

perl-tiny-json

 invalid_correct
YAML::Tiny failed to classify line '[ a, b, c,#invalid' at /yaml/bin/perl-tiny-json line 12.

perl-tiny-perl

 invalid_correct
YAML::Tiny failed to classify line '[ a, b, c,#invalid' at /yaml/bin/perl-tiny-perl line 15.

perl-yaml-json

 invalid_correct
YAML Error: Expected separator '---'
   Code: YAML_PARSE_ERR_NO_SEPARATOR
   Line: 2
   Document: 2
 at /perl5/lib/perl5/YAML/Loader.pm line 88.

perl-yaml-perl

 invalid_correct
YAML Error: Expected separator '---'
   Code: YAML_PARSE_ERR_NO_SEPARATOR
   Line: 2
   Document: 2
 at /perl5/lib/perl5/YAML/Loader.pm line 88.