YAML Test Matrix

Test #SBG9 - Flow Sequence in Flow Mapping

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

java-event

 ok

java-json

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

js-yaml-json

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

libyaml-event

 ok

luajit-json

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

nimyaml-event

 ok

perl5-pegex-event

 ok

perl5-pm-json

 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 350.

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 350.

perl5-pp-event

 ok

perl5-pp-json

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

perl5-pp-pl

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

perl5-syck-json

 n/a
{"ARRAY(0x133d730)":"f","a":["b","c"]}

perl5-syck-pl

 n/a
{
  'ARRAY(0x12e2ef8)' => 'f',
  'a' => [
           'b',
           'c'
         ]
}

perl5-tiny-json

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

perl5-tiny-pl

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

perl5-xs-json

 n/a
{"ARRAY(0x1dc15b0)":"f","a":["b","c"]}

perl5-xs-pl

 n/a
{
  'ARRAY(0xd90088)' => 'f',
  'a' => [
           'b',
           'c'
         ]
}

pyyaml-event

 ok

pyyaml-json

 error
Traceback (most recent call last):
  File "/bin/pyyaml-json", line 8, 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}
                ^

pyyaml-py

 error
Traceback (most recent call last):
  File "/bin/pyyaml-py", line 7, 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-event

 ok

ruamel-json

 error
Error json.dumps: <type 'exceptions.TypeError'>
Traceback (most recent call last):
  File "/bin/ruamel-json", line 10, in <module>
    print json.dumps(doc, sort_keys=True, indent=2)
  File "/usr/lib/python2.7/json/__init__.py", line 251, in dumps
    sort_keys=sort_keys, **kw).encode(obj)
  File "/usr/lib/python2.7/json/encoder.py", line 209, in encode
    chunks = list(chunks)
  File "/usr/lib/python2.7/json/encoder.py", line 434, in _iterencode
    for chunk in _iterencode_dict(o, _current_indent_level):
  File "/usr/lib/python2.7/json/encoder.py", line 382, in _iterencode_dict
    raise TypeError("key " + repr(key) + " is not a string")
TypeError: key ('d', 'e') is not a string

ruamel-py

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

ruby-json

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