# YAML Test Matrix

--- &test-LX3P
  Title: Implicit Flow Mapping Key on one line
  Tags: [ 1.3-err, complex-key, flow, mapping, sequence ]

YAML

[flow]: block

Expected Events

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

Expected JSON



c-libfyaml-event

 ok

c-libyaml-event

 ok

cpp-yamlcpp-event

 ok

dotnet-yamldotnet-event

 ok

hs-hsyaml-event

 ok

js-yaml-event

 ok

nim-nimyaml-event

 ok

perl-refparser-event

 ok

py-pyyaml-event

 ok

py-ruamel-event

 ok

rust-yamlrust-event

 ok

cpp-rapidyaml-event

 error
/tmp/rapidyaml-0.4.0-src/src/c4/yml/parse.cpp:3309:check failed: !m_tree->has_children(parent_id)
Aborted (core dumped)

perl-pp-event

 error
+STR
+DOC
+SEQ []
=VAL :flow
-SEQ
Line      : 1
Column    : 7
Expected  : EOL
Got       : COLON
Where     : /perl5/lib/perl5/YAML/PP/Parser.pm line 392
YAML      : ": block\n"
  at /yaml/bin/perl-pp-event line 46.

perl-pp-perl

 error
Line      : 1
Column    : 7
Expected  : EOL
Got       : COLON
Where     : /perl5/lib/perl5/YAML/PP/Parser.pm line 392
YAML      : ": block\n"
  at /perl5/lib/perl5/YAML/PP/Loader.pm line 94.

perl-syck-perl

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

py-pyyaml-py

 error
Traceback (most recent call last):
  File "/yaml/bin/py-pyyaml-py", line 36, in <module>
    for doc in yaml.load_all(sys.stdin.read(), Loader=yaml.FullLoader):
  File "/python/lib/python3.12/site-packages/yaml/__init__.py", line 130, in load_all
    yield loader.get_data()
          ^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 45, in get_data
    return self.construct_document(self.get_node())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 60, in construct_document
    for dummy in generator:
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 413, in construct_yaml_map
    value = self.construct_mapping(node)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 218, in construct_mapping
    return super().construct_mapping(node, deep=deep)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 141, in construct_mapping
    raise ConstructorError("while constructing a mapping", node.start_mark,
yaml.constructor.ConstructorError: while constructing a mapping
found unhashable key
  in "<unicode string>", line 1, column 1:
    [flow]: block
    ^

c-libfyaml-json

 na
{
stdin:1:1: error: Non scalar keys are not allowed in JSON emit mode
[flow]: block
^~~~~~

dotnet-yamldotnet-json

 na
{? ["flow"] : "block"}

go-yaml-json

 na
yaml: invalid map key: []interface {}{"flow"}

hs-hsyaml-json

 na
{"[\"flow\"]":"block"}

hs-reference-yeast

 na
Line  Col Char Byte Token|Content
   1    0    0    0 +DOC |
   1    0    0    0 +NODE|
   1    0    0    0 +MAP |
   1    0    0    0 +PAIR|
   1    0    0    0 +NODE|
   1    0    0    0 +SEQ |
   1    0    0    0 =SYNX|[
   1    1    1    1 +NODE|
   1    1    1    1 +VAL |
   1    1    1    1 =TEXT|flow
   1    5    5    5 -VAL |
   1    5    5    5 -NODE|
   1    5    5    5 =SYNX|]
   1    6    6    6 -SEQ |
   1    6    6    6 -NODE|
   1    6    6    6 =SYNX|:
   1    7    7    7 =WSPC|.
   1    8    8    8 +NODE|
   1    8    8    8 +VAL |
   1    8    8    8 =TEXT|block
   1   13   13   13 -VAL |
   1   13   13   13 -NODE|
   1   13   13   13 =EOL |\x0a
   2    0   14   14 -PAIR|
   2    0   14   14 -MAP |
   2    0   14   14 -NODE|
   2    0   14   14 -DOC |

js-jsyaml-json

 na
{"flow":"block"}

js-yaml-json

 na
{
  "[ flow ]": "block"
}
(node:2912) Warning: Keys with collection values will be stringified due to JS Object restrictions: "[ flow ]". Set mapAsMap: true to use object keys.
(Use `node --trace-warnings ...` to show where the warning was created)

lua-lyaml-json

 na
luajit: /yaml/bin/lua-lyaml-json:8: Cannot serialise table: table key must be a number or string
stack traceback:
	[C]: in function 'encode'
	/yaml/bin/lua-lyaml-json:8: in main chunk
	[C]: at 0x556e6c27ced0

perl-pp-json

 na
Line      : 1
Column    : 7
Expected  : EOL
Got       : COLON
Where     : /perl5/lib/perl5/YAML/PP/Parser.pm line 392
YAML      : ": block\n"
  at /perl5/lib/perl5/YAML/PP/Loader.pm line 94.

perl-pplibyaml-json

 na
{
   "['flow']" : "block"
}

perl-pplibyaml-perl

 na
{
  '[\'flow\']' => 'block'
}

perl-syck-json

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

perl-tiny-json

 na
{
   "[flow]" : "block"
}

perl-tiny-perl

 na
{
  '[flow]' => 'block'
}

perl-xs-json

 na
{
   "ARRAY(0x7f38af9a28a0)" : "block"
}

perl-xs-perl

 na
{
  'ARRAY(0x7fe6ffd55608)' => 'block'
}

perl-yaml-json

 na
{
   "ARRAY(0x7fd2d456c7d8)" : "block"
}

perl-yaml-perl

 na
{
  'ARRAY(0x7fe5c4578088)' => 'block'
}

py-pyyaml-json

 na
Traceback (most recent call last):
  File "/yaml/bin/py-pyyaml-json", line 19, in <module>
    for doc in yaml.load_all(sys.stdin.read(), Loader=yaml.FullLoader):
  File "/python/lib/python3.12/site-packages/yaml/__init__.py", line 130, in load_all
    yield loader.get_data()
          ^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 45, in get_data
    return self.construct_document(self.get_node())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 60, in construct_document
    for dummy in generator:
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 413, in construct_yaml_map
    value = self.construct_mapping(node)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 218, in construct_mapping
    return super().construct_mapping(node, deep=deep)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 141, in construct_mapping
    raise ConstructorError("while constructing a mapping", node.start_mark,
yaml.constructor.ConstructorError: while constructing a mapping
found unhashable key
  in "<unicode string>", line 1, column 1:
    [flow]: block
    ^

py-ruamel-json

 na
{
  
}

py-ruamel-py

 na
{('flow',): 'block'}

ruby-psych-json

 na
{"[\"flow\"]":"block"}