# YAML Test Matrix

--- &test-6PBE
  Title: Zero-indented sequences in explicit mapping keys
  Tags: [ 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



cpp-event

 ok

hs-yaml-event

 ok

java-event

 ok

js-event

 ok

libyaml-event

 ok

nimyaml-event

 ok

perl5-pp-event

 ok

pyyaml-event

 ok

ruamel-event

 ok

perl5-pegex-event

 error
Maximum parsing rules reached (1000)

perl5-pm-pl

 error
Use of uninitialized value $key in string at /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 /lib/perl5/YAML/Loader.pm line 360.

perl5-syck-pl

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

perl5-tiny-pl

 error
YAML::Tiny does not support a feature in line '?' at /bin/perl5-tiny-pl line 15.

pyyaml-py

 error
Traceback (most recent call last):
  File "/bin/pyyaml-py", line 36, in <module>
    for doc in yaml.load_all(sys.stdin.read()):
  File "/lib/python2.7/site-packages/yaml/__init__.py", line 90, in load_all
    yield loader.get_data()
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 33, in get_data
    return self.construct_document(self.get_node())
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 48, in construct_document
    for dummy in generator:
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 398, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 208, in construct_mapping
    return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 132, in construct_mapping
    "found unacceptable key (%s)" % exc, key_node.start_mark)
yaml.constructor.ConstructorError: while constructing a mapping
  in "<string>", line 2, column 1:
    ?
    ^
found unacceptable key (unhashable type: 'list')
  in "<string>", line 3, column 1:
    - a
    ^

hs-yaml-json

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

java-json

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

js-json

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

js-yaml-json

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

luajit-json

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

perl5-pm-json

 na
Use of uninitialized value $key in string at /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 /lib/perl5/YAML/Loader.pm line 360.

perl5-pp-json

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

perl5-pp-pl

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

perl5-syck-json

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

perl5-tiny-json

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

perl5-xs-json

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

perl5-xs-pl

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

pyyaml-json

 na
Traceback (most recent call last):
  File "/bin/pyyaml-json", line 19, in <module>
    for doc in yaml.load_all(sys.stdin.read()):
  File "/lib/python2.7/site-packages/yaml/__init__.py", line 90, in load_all
    yield loader.get_data()
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 33, in get_data
    return self.construct_document(self.get_node())
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 48, in construct_document
    for dummy in generator:
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 398, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 208, in construct_mapping
    return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 132, in construct_mapping
    "found unacceptable key (%s)" % exc, key_node.start_mark)
yaml.constructor.ConstructorError: while constructing a mapping
  in "<string>", line 2, column 1:
    ?
    ^
found unacceptable key (unhashable type: 'list')
  in "<string>", line 3, column 1:
    - a
    ^

ruamel-json

 na
{
  
}

ruamel-py

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

ruby-json

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