# YAML Test Matrix

--- &test-9JBA
  Title: Invalid comment after end of flow sequence
  Tags: [ comment, error, flow, sequence ]

YAML

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

Expected Events

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

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-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:13: error: invalid comment after end of flow sequence
[ a, b, c, ]#invalid
            ^
[NOT]: fy_fetch_flow_collection_mark_end() failed
[NOT]: fy_fetch_tokens() failed
[NOT]: failed to peek token
+STR
+DOC ---

c-libfyaml-json

 invalid_correct
stdin:2:13: error: invalid comment after end of flow sequence
[ a, b, c, ]#invalid
            ^
[NOT]: fy_fetch_flow_collection_mark_end() failed
[NOT]: fy_fetch_tokens() failed
[NOT]: failed to peek token

dotnet-yamldotnet-event

 invalid_correct
Unhandled exception. YamlDotNet.Core.SemanticErrorException: (Line: 2, Col: 12, Idx: 15) - (Line: 2, Col: 12, Idx: 15): Did not find expected <document end>.
   at YamlDotNet.Core.Parser.ParseDocumentEnd()
   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
-SEQ

dotnet-yamldotnet-json

 invalid_correct
Unhandled exception. YamlDotNet.Core.SemanticErrorException: (Line: 2, Col: 12, Idx: 15) - (Line: 2, Col: 12, Idx: 15): Did not find expected <document end>.
   at YamlDotNet.Core.Parser.ParseDocumentEnd()
   at YamlDotNet.Core.Parser.StateMachine()
   at YamlDotNet.Core.Parser.MoveNext()
   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 13:

[ 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 13:

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

    at Composer.onError (/node/node_modules/yaml/dist/compose/composer.js:71:34)
    at Object.resolveEnd (/node/node_modules/yaml/dist/compose/resolve-end.js:16:25)
    at Object.resolveFlowCollection (/node/node_modules/yaml/dist/compose/resolve-flow-collection.js:176:32)
    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    : 13
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
-SEQ

perl-pp-json

 invalid_correct
Line      : 2
Column    : 13
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    : 13
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-syck-json

 invalid_correct
Syck parser (line 2, column 12): syntax error at /perl5/lib/perl5/x86_64-linux-thread-multi/YAML/Syck.pm line 60, <> line 1.

perl-syck-perl

 invalid_correct
Syck parser (line 2, column 12): syntax error at /perl5/lib/perl5/x86_64-linux-thread-multi/YAML/Syck.pm line 60, <> 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.