YAML Test Matrix

Test #LX3P - Implicit Flow Mapping Key on one line

YAML

[flow]: block

Expected Events

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

Expected JSON



cpp-event

 ok

java-event

 ok

java-json

 n/a
{
  "[flow]": "block"
}

js-yaml-json

 n/a
{
  "flow": "block"
}

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

 diff
Got Events:
+STR
+DOC
+SEQ
=VAL :flow
-SEQ
-DOC
+DOC
+MAP
=VAL :
=VAL :block
-MAP
-DOC
-STR

perl5-pm-json

 n/a
{"ARRAY(0x15d11f0)":"block"}

perl5-pm-pl

 n/a
{
  'ARRAY(0x1fa5cc0)' => 'block'
}

perl5-pp-event

 error
+STR
+DOC
+SEQ
=VAL :flow
-SEQ
Use of uninitialized value $next_rule_name in hash element at /lib/perl5/YAML/PP/Parser.pm line 457, <> line 1.
Unexpected at /lib/perl5/YAML/PP/Parser.pm line 525, <> line 1.
 at /bin/perl5-pp-event line 18.

perl5-pp-json

 error
Use of uninitialized value $next_rule_name in hash element at /lib/perl5/YAML/PP/Parser.pm line 457, <> line 1.
Unexpected at /lib/perl5/YAML/PP/Parser.pm line 525, <> line 1.
 at /lib/perl5/YAML/PP/Loader.pm line 52.

perl5-pp-pl

 error
Use of uninitialized value $next_rule_name in hash element at /lib/perl5/YAML/PP/Parser.pm line 457, <> line 1.
Unexpected at /lib/perl5/YAML/PP/Parser.pm line 525, <> line 1.
 at /lib/perl5/YAML/PP/Loader.pm line 52.

perl5-syck-json

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

perl5-syck-pl

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

perl5-tiny-json

 n/a
{"[flow]":"block"}

perl5-tiny-pl

 n/a
{
  '[flow]' => 'block'
}

perl5-xs-json

 n/a
{"ARRAY(0x2805800)":"block"}

perl5-xs-pl

 n/a
{
  'ARRAY(0x151eab0)' => 'block'
}

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
found unacceptable key (unhashable type: 'list')
  in "<string>", line 1, column 1:
    [flow]: block
    ^

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
found unacceptable key (unhashable type: 'list')
  in "<string>", line 1, column 1:
    [flow]: block
    ^

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 ('flow',) is not a string

ruamel-py

 n/a
{('flow',): 'block'}

ruby-json

 n/a
{"[\"flow\"]":"block"}