# YAML Test Matrix

--- &test-9C9N
  Title: Wrong indented flow sequence
  Tags: [ error, flow, indent, sequence ]

YAML

---
flow: [a,
b,
c]

Expected Events

+STR
+DOC ---
+MAP
=VAL :flow
+SEQ []
=VAL :a

Expected JSON



c-libyaml-event

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

cpp-rapidyaml-event

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

cpp-yamlcpp-event

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

go-yaml-json

 invalid_incorrect
{"flow":["a","b","c"]}

hs-reference-yeast

 invalid_incorrect
Line  Col Char Byte Token|Content
   1    0    0    0 +DOC |
   1    0    0    0 =HEAD|---
   1    3    3    3 +NODE|
   1    3    3    3 =EOL |\x0a
   2    0    4    4 +MAP |
   2    0    4    4 +PAIR|
   2    0    4    4 +NODE|
   2    0    4    4 +VAL |
   2    0    4    4 =TEXT|flow
   2    4    8    8 -VAL |
   2    4    8    8 -NODE|
   2    4    8    8 =SYNX|:
   2    5    9    9 =WSPC|.
   2    6   10   10 +NODE|
   2    6   10   10 +SEQ |
   2    6   10   10 =SYNX|[
   2    7   11   11 +NODE|
   2    7   11   11 +VAL |
   2    7   11   11 =TEXT|a
   2    8   12   12 -VAL |
   2    8   12   12 -NODE|
   2    8   12   12 =SYNX|,
   2    9   13   13 -SEQ |
   2    9   13   13 -NODE|
   2    9   13   13 =ERR |Unexpected.'\x0a'
   2    9   13   13 =REST|\x0a
   3    0   14   14 -PAIR|
   3    0   14   14 -MAP |
   3    0   14   14 -NODE|
   3    0   14   14 -DOC |
   3    0   14   14 =ERR |Unexpected.'b'

js-jsyaml-json

 invalid_incorrect
{"flow":["a","b","c"]}

lua-lyaml-json

 invalid_incorrect
{"flow":["a","b","c"]}

perl-pplibyaml-json

 invalid_incorrect
{
   "flow" : [
      "a",
      "b",
      "c"
   ]
}

perl-pplibyaml-perl

 invalid_incorrect
{
  'flow' => [
              'a',
              'b',
              'c'
            ]
}

perl-syck-json

 invalid_incorrect
{
   "flow" : [
      "a",
      "b",
      "c"
   ]
}

perl-syck-perl

 invalid_incorrect
{
  'flow' => [
              'a',
              'b',
              'c'
            ]
}

perl-xs-json

 invalid_incorrect
{
   "flow" : [
      "a",
      "b",
      "c"
   ]
}

perl-xs-perl

 invalid_incorrect
{
  'flow' => [
              'a',
              'b',
              'c'
            ]
}

py-pyyaml-event

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

py-pyyaml-json

 invalid_incorrect
{
  "flow": [
    "a",
    "b",
    "c"
  ]
}

py-pyyaml-py

 invalid_incorrect
{'flow': ['a', 'b', 'c']}

py-ruamel-event

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

py-ruamel-json

 invalid_incorrect
{
  "flow": [
    "a",
    "b",
    "c"
  ]
}

py-ruamel-py

 invalid_incorrect
{'flow': ['a', 'b', 'c']}

ruby-psych-json

 invalid_incorrect
{"flow":["a","b","c"]}

c-libfyaml-event

 invalid_correct
stdin:3:1: error: wrongly indented flow sequence
b,
^
+STR
+DOC ---
+MAP
=VAL :flow
+SEQ []
=VAL :a

c-libfyaml-json

 invalid_correct
stdin:3:1: error: wrongly indented flow sequence
b,
^

dotnet-yamldotnet-event

 invalid_correct
Unhandled exception. System.Exception: Exception of type 'System.Exception' was thrown.
   at YamlDotNet.Core.Scanner.ScanPlainScalar(Boolean& isMultiline)
   at YamlDotNet.Core.Scanner.FetchPlainScalar()
   at YamlDotNet.Core.Scanner.FetchNextToken()
   at YamlDotNet.Core.Scanner.FetchMoreTokens()
   at YamlDotNet.Core.Scanner.MoveNextWithoutConsuming()
   at YamlDotNet.Core.Parser.GetCurrentToken()
   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 ---
+MAP
=VAL :flow
+SEQ
=VAL :a

dotnet-yamldotnet-json

 invalid_correct
Unhandled exception. YamlDotNet.Core.YamlException: (Line: 2, Col: 8, Idx: 11) - (Line: 2, Col: 9, Idx: 12): Exception during deserialization
 ---> System.Exception: Exception of type 'System.Exception' was thrown.
   at YamlDotNet.Core.Scanner.ScanPlainScalar(Boolean& isMultiline)
   at YamlDotNet.Core.Scanner.FetchPlainScalar()
   at YamlDotNet.Core.Scanner.FetchNextToken()
   at YamlDotNet.Core.Scanner.FetchMoreTokens()
   at YamlDotNet.Core.Scanner.MoveNextWithoutConsuming()
   at YamlDotNet.Core.Parser.GetCurrentToken()
   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)
   --- End of inner exception stack trace ---
   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.ValueDeserializers.NodeValueDeserializer.<>c__DisplayClass3_0.<DeserializeValue>b__0(IParser r, Type t)
   at YamlDotNet.Serialization.NodeDeserializers.DictionaryNodeDeserializer.DeserializeHelper(Type tKey, Type tValue, IParser parser, Func`3 nestedObjectDeserializer, IDictionary result)
   at YamlDotNet.Serialization.NodeDeserializers.DictionaryNodeDeserializer.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 = 13, posCharOffset = 13, posLine = 2, posColumn = 9} (Unexpected '
')
+STR
+DOC ---
+MAP
=VAL :flow
+SEQ []
=VAL :a
-SEQ

hs-hsyaml-json

 invalid_correct
hsyaml-parser: user error (Unexpected '
')

js-yaml-event

 invalid_correct
Flow sequence in block collection must be sufficiently indented and end with a ] at line 3, column 1:

flow: [a,
b,
^
+STR
+DOC ---
+MAP
=VAL :flow
+SEQ []
=VAL :a
-SEQ

js-yaml-json

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

YAMLParseError: Flow sequence in block collection must be sufficiently indented and end with a ] at line 3, column 1:

flow: [a,
b,
^

    at Composer.onError (/node/node_modules/yaml/dist/compose/composer.js:69:34)
    at Object.resolveFlowCollection (/node/node_modules/yaml/dist/compose/resolve-flow-collection.js:183:9)
    at resolveCollection (/node/node_modules/yaml/dist/compose/compose-collection.js:16:37)
    at Object.composeCollection (/node/node_modules/yaml/dist/compose/compose-collection.js:47:16)
    at composeNode (/node/node_modules/yaml/dist/compose/compose-node.js:31:38)
    at Object.resolveBlockMap (/node/node_modules/yaml/dist/compose/resolve-block-map.js:83:19)
    at resolveCollection (/node/node_modules/yaml/dist/compose/compose-collection.js:13:27)
    at Object.composeCollection (/node/node_modules/yaml/dist/compose/compose-collection.js:47:16)
    at Object.composeNode (/node/node_modules/yaml/dist/compose/compose-node.js:31:38)
    at Object.composeDoc (/node/node_modules/yaml/dist/compose/compose-doc.js:34:23) {
  code: 'BAD_INDENT',
  pos: [ 14, 15 ],
  linePos: [ { line: 3, col: 1 }, { line: 3, col: 2 } ]
}

Node.js v20.13.1

nim-nimyaml-event

 invalid_correct
/tmp/NimYAML-0.16.0/yaml/stream.nim(134) nimyaml_event
/tmp/NimYAML-0.16.0/yaml/stream.nim(99) next
/tmp/NimYAML-0.16.0/yaml/parser.nim(160) :anonymous
/tmp/NimYAML-0.16.0/yaml/parser.nim(470) atBlockIndentationProps
/tmp/NimYAML-0.16.0/yaml/stream.nim(106) next
[[reraised from:
/tmp/NimYAML-0.16.0/yaml/stream.nim(134) nimyaml_event
/tmp/NimYAML-0.16.0/yaml/stream.nim(101) next
]]
Error: unhandled exception: Too few indentation spaces (must surpass surrounding block level) [YamlStreamError]
+STR
+DOC ---
+MAP
=VAL :flow

perl-pp-event

 invalid_correct
Line      : 3
Column    : 1
Message   : Bad indendation in FLOWSEQ
Where     : /perl5/lib/perl5/YAML/PP/Parser.pm line 199
YAML      : "b,\n"
  at /yaml/bin/perl-pp-event line 46.
+STR
+DOC ---
+MAP
=VAL :flow
+SEQ []
=VAL :a

perl-pp-json

 invalid_correct
Line      : 3
Column    : 1
Message   : Bad indendation in FLOWSEQ
Where     : /perl5/lib/perl5/YAML/PP/Parser.pm line 199
YAML      : "b,\n"
  at /perl5/lib/perl5/YAML/PP/Loader.pm line 94.

perl-pp-perl

 invalid_correct
Line      : 3
Column    : 1
Message   : Bad indendation in FLOWSEQ
Where     : /perl5/lib/perl5/YAML/PP/Parser.pm line 199
YAML      : "b,\n"
  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 4056, <> line 1.

perl-tiny-json

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

perl-tiny-perl

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

perl-yaml-json

 invalid_correct
YAML Error: Can't parse inline sequence
   Code: YAML_PARSE_ERR_INLINE_SEQUENCE
   Line: 3
   Document: 1
 at /perl5/lib/perl5/YAML/Loader.pm line 551.

perl-yaml-perl

 invalid_correct
YAML Error: Can't parse inline sequence
   Code: YAML_PARSE_ERR_INLINE_SEQUENCE
   Line: 3
   Document: 1
 at /perl5/lib/perl5/YAML/Loader.pm line 551.

rust-yamlrust-event

 invalid_correct
Error: ScanError { mark: Marker { index: 15, line: 3, col: 1 }, info: "simple key expected" }
+STR
+DOC
+MAP
=VAL :flow
+SEQ
=VAL :a