# YAML Test Matrix

--- &test-SBG9
  Title: Flow Sequence in Flow Mapping
  Tags: [ flow, mapping, sequence ]

YAML

{a: [b, c], [d, e]: f}

Expected Events

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

 ok

perl5-pp-event

 ok

pyyaml-event

 ok

ruamel-event

 ok

perl5-pm-pl

 error
YAML Error: Invalid element in map
   Code: YAML_LOAD_ERR_BAD_MAP_ELEMENT
   Line: 1
   Document: 1
 at /lib/perl5/YAML/Loader.pm line 360.

perl5-tiny-pl

 error
YAML::Tiny found illegal characters in plain scalar: '[b, c], [d, e]: f}' 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 1, column 1:
    {a: [b, c], [d, e]: f}
    ^
found unacceptable key (unhashable type: 'list')
  in "<string>", line 1, column 13:
    {a: [b, c], [d, e]: f}
                ^

hs-yaml-json

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

java-json

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

js-json

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

js-yaml-json

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

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
YAML Error: Invalid element in map
   Code: YAML_LOAD_ERR_BAD_MAP_ELEMENT
   Line: 1
   Document: 1
 at /lib/perl5/YAML/Loader.pm line 360.

perl5-pp-json

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

perl5-pp-pl

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

perl5-syck-json

 na
{
   "ARRAY(0x25a5970)" : "f",
   "a" : [
      "b",
      "c"
   ]
}

perl5-syck-pl

 na
{
  'ARRAY(0x150b858)' => 'f',
  'a' => [
         'b',
         'c'
       ]
}

perl5-tiny-json

 na
YAML::Tiny found illegal characters in plain scalar: '[b, c], [d, e]: f}' at /bin/perl5-tiny-json line 12.

perl5-xs-json

 na
{
   "ARRAY(0x27f38b8)" : "f",
   "a" : [
      "b",
      "c"
   ]
}

perl5-xs-pl

 na
{
  'ARRAY(0x183e640)' => 'f',
  'a' => [
           'b',
           'c'
         ]
}

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 1, column 1:
    {a: [b, c], [d, e]: f}
    ^
found unacceptable key (unhashable type: 'list')
  in "<string>", line 1, column 13:
    {a: [b, c], [d, e]: f}
                ^

ruamel-json

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

ruamel-py

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

ruby-json

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