# YAML Test Matrix

--- &test-G5U8
  Title: Plain dashes in flow sequence
  Tags: [ flow, sequence ]

YAML

---
- [-, -]

Expected Events

+STR
+DOC ---
+SEQ
+SEQ []

Expected JSON



c-libyaml-event

 invalid_incorrect
+STR
+DOC ---
+SEQ
+SEQ []
=VAL :-
=VAL :-
-SEQ
-SEQ
-DOC
-STR

cpp-rapidyaml-event

 invalid_incorrect
+STR
+DOC ---
+SEQ
+SEQ
=VAL :-
=VAL :-
-SEQ
-SEQ
-DOC
-STR

cpp-yamlcpp-event

 invalid_incorrect
+STR
+DOC
+SEQ
+SEQ []
=VAL :-
=VAL :-
-SEQ
-SEQ
-DOC
-STR

dotnet-yamldotnet-event

 invalid_incorrect
+STR
+DOC ---
+SEQ
+SEQ
=VAL :-
=VAL :-
-SEQ
-SEQ
-DOC
-STR

dotnet-yamldotnet-json

 invalid_incorrect
[["-", "-"]]

go-yaml-json

 invalid_incorrect
[["-","-"]]

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 +SEQ |
   2    0    4    4 =SYNX|-
   2    1    5    5 =WSPC|.
   2    2    6    6 +NODE|
   2    2    6    6 +SEQ |
   2    2    6    6 =SYNX|[
   2    3    7    7 +NODE|
   2    3    7    7 +VAL |
   2    3    7    7 =TEXT|-
   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 +VAL |
   2    6   10   10 =TEXT|-
   2    7   11   11 -VAL |
   2    7   11   11 -NODE|
   2    7   11   11 =SYNX|]
   2    8   12   12 -SEQ |
   2    8   12   12 -NODE|
   2    8   12   12 =EOL |\x0a
   3    0   13   13 -SEQ |
   3    0   13   13 -NODE|
   3    0   13   13 -DOC |

lua-lyaml-json

 invalid_incorrect
[["-","-"]]

perl-pplibyaml-json

 invalid_incorrect
[
   [
      "-",
      "-"
   ]
]

perl-pplibyaml-perl

 invalid_incorrect
[
  [
    '-',
    '-'
  ]
]

perl-syck-json

 invalid_incorrect
[
   [
      "-",
      "-"
   ]
]

perl-syck-perl

 invalid_incorrect
[
  [
    '-',
    '-'
  ]
]

perl-tiny-json

 invalid_incorrect
[
   "[-, -]"
]

perl-tiny-perl

 invalid_incorrect
[
  '[-, -]'
]

perl-xs-json

 invalid_incorrect
[
   [
      "-",
      "-"
   ]
]

perl-xs-perl

 invalid_incorrect
[
  [
    '-',
    '-'
  ]
]

perl-yaml-json

 invalid_incorrect
Argument "-" isn't numeric in addition (+) at /perl5/lib/perl5/YAML/Loader.pm line 491, <> line 1.
Argument "-" isn't numeric in addition (+) at /perl5/lib/perl5/YAML/Loader.pm line 491, <> line 1.
[
   [
      0,
      0
   ]
]

perl-yaml-perl

 invalid_incorrect
Argument "-" isn't numeric in addition (+) at /perl5/lib/perl5/YAML/Loader.pm line 491, <> line 1.
Argument "-" isn't numeric in addition (+) at /perl5/lib/perl5/YAML/Loader.pm line 491, <> line 1.
[
  [
    '0',
    '0'
  ]
]

py-pyyaml-event

 invalid_incorrect
+STR
+DOC ---
+SEQ
+SEQ []
=VAL :-
=VAL :-
-SEQ
-SEQ
-DOC
-STR

py-pyyaml-json

 invalid_incorrect
[
  [
    "-",
    "-"
  ]
]

py-pyyaml-py

 invalid_incorrect
[['-', '-']]

py-ruamel-event

 invalid_incorrect
+STR
+DOC ---
+SEQ
+SEQ []
=VAL :-
=VAL :-
-SEQ
-SEQ
-DOC
-STR

py-ruamel-json

 invalid_incorrect
[
  [
    "-",
    "-"
  ]
]

py-ruamel-py

 invalid_incorrect
[['-', '-']]

ruby-psych-json

 invalid_incorrect
[["-","-"]]

rust-yamlrust-event

 invalid_incorrect
+STR
+DOC
+SEQ
+SEQ
=VAL :-
=VAL :-
-SEQ
-SEQ
-DOC
-STR

c-libfyaml-event

 invalid_correct
stdin:2:4: error: plain scalar cannot start with '-' followed by ,[]{} (in flow context)
- [-, -]
   ^~
+STR
+DOC ---
+SEQ

c-libfyaml-json

 invalid_correct
stdin:2:4: error: plain scalar cannot start with '-' followed by ,[]{} (in flow context)
- [-, -]
   ^~

hs-hsyaml-event

 invalid_correct
Parsing error near byte offset Pos {posByteOffset = 7, posCharOffset = 7, posLine = 2, posColumn = 3} (Unexpected '-')
+STR
+DOC ---
+SEQ
+SEQ []
-SEQ

hs-hsyaml-json

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

js-jsyaml-json

 invalid_correct
/node/node_modules/js-yaml/lib/loader.js:187
  throw generateError(state, message);
  ^
YAMLException: missed comma between flow collection entries (2:4)

 1 | ---
 2 | - [-, -]
--------^
    at generateError (/node/node_modules/js-yaml/lib/loader.js:183:10)
    at throwError (/node/node_modules/js-yaml/lib/loader.js:187:9)
    at readFlowCollection (/node/node_modules/js-yaml/lib/loader.js:758:7)
    at composeNode (/node/node_modules/js-yaml/lib/loader.js:1442:11)
    at readBlockMapping (/node/node_modules/js-yaml/lib/loader.js:1104:12)
    at composeNode (/node/node_modules/js-yaml/lib/loader.js:1441:12)
    at readBlockSequence (/node/node_modules/js-yaml/lib/loader.js:1008:5)
    at composeNode (/node/node_modules/js-yaml/lib/loader.js:1440:12)
    at readDocument (/node/node_modules/js-yaml/lib/loader.js:1625:3)
    at loadDocuments (/node/node_modules/js-yaml/lib/loader.js:1688:5) {
  reason: 'missed comma between flow collection entries',
  mark: {
    name: null,
    buffer: '---\n- [-, -]\n',
    position: 7,
    line: 1,
    column: 3,
    snippet: ' 1 | ---\n 2 | - [-, -]\n--------^'
  }
}

Node.js v20.13.1

js-yaml-event

 invalid_correct
Implicit keys of flow sequence pairs need to be on a single line at line 2, column 4:

- [-, -]
   ^
+STR
+DOC ---
+SEQ
+SEQ []

js-yaml-json

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

YAMLParseError: Implicit keys of flow sequence pairs need to be on a single line at line 2, column 4:

- [-, -]
   ^

    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:52:17)
    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.resolveBlockSeq (/node/node_modules/yaml/dist/compose/resolve-block-seq.js:38:15)
    at resolveCollection (/node/node_modules/yaml/dist/compose/compose-collection.js:15:31)
    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: 'MULTILINE_IMPLICIT_KEY',
  pos: [ 7, 8 ],
  linePos: [ { line: 2, col: 4 }, { line: 2, col: 5 } ]
}

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: Unexpected token (expected flow node): SeqItemInd [YamlStreamError]
+STR
+DOC ---
+SEQ

perl-pp-event

 invalid_correct
Line      : 2
Column    : 4
Message   : Invalid plain scalar
Where     : /perl5/lib/perl5/YAML/PP/Lexer.pm line 378
YAML      : "-, -]"
  at /yaml/bin/perl-pp-event line 46.
+STR
+DOC ---
+SEQ
+SEQ []

perl-pp-json

 invalid_correct
Line      : 2
Column    : 4
Message   : Invalid plain scalar
Where     : /perl5/lib/perl5/YAML/PP/Lexer.pm line 378
YAML      : "-, -]"
  at /perl5/lib/perl5/YAML/PP/Loader.pm line 94.

perl-pp-perl

 invalid_correct
Line      : 2
Column    : 4
Message   : Invalid plain scalar
Where     : /perl5/lib/perl5/YAML/PP/Lexer.pm line 378
YAML      : "-, -]"
  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.