# YAML Test Matrix

--- &test-6PBE
  Title: Zero-indented sequences in explicit mapping keys
  Tags: [ explicit-key, mapping, sequence ]

YAML

---
?
- a
- b
:
- c
- d

Expected Events

+STR
+DOC ---
+MAP
+SEQ
=VAL :a
=VAL :b
-SEQ
+SEQ
=VAL :c
=VAL :d
-SEQ
-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

java-snakeyaml-event

 ok

js-yaml-event

 ok

nim-nimyaml-event

 ok

perl-pp-event

 ok

perl-pplibyaml-event

 ok

perl-refparser-event

 ok

py-pyyaml-event

 ok

py-ruamel-event

 ok

perl-syck-perl

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

perl-yaml-perl

 error
Use of uninitialized value $key in string at /perl5/lib/perl5/YAML/Loader.pm line 341, <> line 1.
YAML Error: Invalid element in map
   Code: YAML_LOAD_ERR_BAD_MAP_ELEMENT
   Line: 3
   Document: 1
 at /perl5/lib/perl5/YAML/Loader.pm line 360.

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.7/site-packages/yaml/__init__.py", line 130, in load_all
    yield loader.get_data()
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 45, in get_data
    return self.construct_document(self.get_node())
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 60, in construct_document
    for dummy in generator:
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 413, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 218, in construct_mapping
    return super().construct_mapping(node, deep=deep)
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 142, in construct_mapping
    "found unhashable key", key_node.start_mark)
yaml.constructor.ConstructorError: while constructing a mapping
  in "<unicode string>", line 2, column 1:
    ?
    ^
found unhashable key
  in "<unicode string>", line 3, column 1:
    - a
    ^

c-libfyaml-json

 na
{
stdin:3:1: error: Non scalar keys are not allowed in JSON emit mode
- a
^~~
- b
~~~

dotnet-yamldotnet-json

 na
{? ["a", "b"] : ["c", "d"]}

hs-hsyaml-json

 na
{"[\"a\",\"b\"]":["c","d"]}

java-snakeyaml-json

 na
{
  "[a, b]": [
    "c",
    "d"
  ]
}

js-jsyaml-json

 na
{"a,b":["c","d"]}

js-yaml-json

 na
{
  "[ a, b ]": [
    "c",
    "d"
  ]
}
(node:709) Warning: Keys with collection values will be stringified due to JS Object restrictions: "[ a, b ]". Set mapAsMap: true to use object keys.

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 0x562102ac2f97

perl-pp-json

 na
{
   "['a','b']" : [
      "c",
      "d"
   ]
}

perl-pp-perl

 na
{
  '[\'a\',\'b\']' => [
                       'c',
                       'd'
                     ]
}

perl-pplibyaml-json

 na
{
   "['a','b']" : [
      "c",
      "d"
   ]
}

perl-pplibyaml-perl

 na
{
  '[\'a\',\'b\']' => [
                       'c',
                       'd'
                     ]
}

perl-syck-json

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

perl-tiny-json

 na
YAML::Tiny does not support a feature in line '?' at /yaml/bin/perl-tiny-json line 12.

perl-xs-json

 na
{
   "ARRAY(0x55d4638ba950)" : [
      "c",
      "d"
   ]
}

perl-xs-perl

 na
{
  'ARRAY(0x5597d808ab70)' => [
                               'c',
                               'd'
                             ]
}

perl-yaml-json

 na
Use of uninitialized value $key in string at /perl5/lib/perl5/YAML/Loader.pm line 341, <> line 1.
YAML Error: Invalid element in map
   Code: YAML_LOAD_ERR_BAD_MAP_ELEMENT
   Line: 3
   Document: 1
 at /perl5/lib/perl5/YAML/Loader.pm line 360.

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.7/site-packages/yaml/__init__.py", line 130, in load_all
    yield loader.get_data()
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 45, in get_data
    return self.construct_document(self.get_node())
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 60, in construct_document
    for dummy in generator:
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 413, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 218, in construct_mapping
    return super().construct_mapping(node, deep=deep)
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 142, in construct_mapping
    "found unhashable key", key_node.start_mark)
yaml.constructor.ConstructorError: while constructing a mapping
  in "<unicode string>", line 2, column 1:
    ?
    ^
found unhashable key
  in "<unicode string>", line 3, column 1:
    - a
    ^

py-ruamel-json

 na
{
  
}

py-ruamel-py

 na
{('a', 'b'): ['c', 'd']}

ruby-psych-json

 na
{"[\"a\", \"b\"]":["c","d"]}

perl-tiny-perl

 ni
YAML::Tiny does not support a feature in line '?' at /yaml/bin/perl-tiny-perl line 15.