# YAML Test Matrix

--- &test-Q9WF
  Title: Spec Example 6.12. Separation Spaces
  Tags: [ 1.3-err, comment, spec, whitespace ]

YAML

{ first: Sammy, last: Sosa }:
# Statistics:
  hr:  # Home runs
     65
  avg: # Average
   0.278

Expected Events

+STR
+DOC
+MAP
+MAP
=VAL :first
=VAL :Sammy
=VAL :last
=VAL :Sosa
-MAP
+MAP
=VAL :hr
=VAL :65
=VAL :avg
=VAL :0.278
-MAP
-MAP
-DOC
-STR

Expected JSON



cpp-event

 ok

hs-yaml-event

 ok

java-event

 ok

js-event

 ok

libyaml-event

 ok

nimyaml-event

 ok

pyyaml-event

 ok

ruamel-event

 ok

perl5-pegex-event

 diff
Got Events:
+STR
+DOC
+MAP
=VAL :first
=VAL :Sammy
=VAL :last
=VAL :Sosa
-MAP
-DOC
+DOC
+MAP
=VAL :
+MAP
=VAL :hr
=VAL :     65
-MAP
+MAP
=VAL :avg
=VAL :   0.278
-MAP
-DOC
-STR

perl5-pm-pl

 error
YAML Error: Expected separator '---'
   Code: YAML_PARSE_ERR_NO_SEPARATOR
   Line: 4
   Document: 2
 at /lib/perl5/YAML/Loader.pm line 88.

perl5-pp-event

 error
+STR
+DOC
+MAP
=VAL :first
=VAL :Sammy
=VAL :last
=VAL :Sosa
-MAP
Expected document end at /lib/perl5/YAML/PP/Parser.pm line 550, <> line 1.
 at /bin/perl5-pp-event line 19.

perl5-pp-pl

 error
Expected document end at /lib/perl5/YAML/PP/Parser.pm line 550, <> line 1.
 at /lib/perl5/YAML/PP/Loader.pm line 59.

perl5-syck-pl

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

perl5-tiny-pl

 error
YAML::Tiny found illegal characters in plain scalar: 'Sammy, last: Sosa }:' 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
found unacceptable key (unhashable type: 'dict')
  in "<string>", line 1, column 1:
    { first: Sammy, last: Sosa }:
    ^

ruamel-py

 error
Traceback (most recent call last):
  File "/bin/ruamel-py", line 36, in <module>
    for doc in ruamel.yaml.load_all(sys.stdin.read(), Loader=ruamel.yaml.Loader):
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/main.py", line 949, in load_all
    yield loader._constructor.get_data()
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 101, in get_data
    return self.construct_document(self.composer.get_node())
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 118, in construct_document
    for _dummy in generator:
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 671, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 398, in construct_mapping
    return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 230, in construct_mapping
    key_node.start_mark,
ruamel.yaml.constructor.ConstructorError: while constructing a mapping
found unacceptable key (unhashable type: 'dict')
  in "<byte string>", line 1, column 1:
    { first: Sammy, last: Sosa }:
    ^ (line: 1)

hs-yaml-json

 na
{"{\"first\":\"Sammy\",\"last\":\"Sosa\"}":{"avg":0.278,"hr":65}}

java-json

 na
{
  "{first\u003dSammy, last\u003dSosa}": {
    "hr": 65,
    "avg": 0.278
  }
}

js-json

 na
{
  "{\"first\":\"Sammy\",\"last\":\"Sosa\"}": {
    "hr": 65,
    "avg": 0.278
  }
}

js-yaml-json

 na
{
  "[object Object]": {
    "hr": 65,
    "avg": 0.278
  }
}

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: Expected separator '---'
   Code: YAML_PARSE_ERR_NO_SEPARATOR
   Line: 4
   Document: 2
 at /lib/perl5/YAML/Loader.pm line 88.

perl5-pp-json

 na
Expected document end at /lib/perl5/YAML/PP/Parser.pm line 550, <> line 1.
 at /lib/perl5/YAML/PP/Loader.pm line 59.

perl5-syck-json

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

perl5-tiny-json

 na
YAML::Tiny found illegal characters in plain scalar: 'Sammy, last: Sosa }:' at /bin/perl5-tiny-json line 12.

perl5-xs-json

 na
{
   "HASH(0x12a5888)" : {
      "avg" : 0.278,
      "hr" : 65
   }
}

perl5-xs-pl

 na
{
  'HASH(0x11425c8)' => {
                         'avg' => '0.278',
                         'hr' => 65
                       }
}

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
found unacceptable key (unhashable type: 'dict')
  in "<string>", line 1, column 1:
    { first: Sammy, last: Sosa }:
    ^

ruamel-json

 na
Traceback (most recent call last):
  File "/bin/ruamel-json", line 19, in <module>
    for doc in ruamel.yaml.load_all(sys.stdin.read(), Loader=ruamel.yaml.Loader):
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/main.py", line 949, in load_all
    yield loader._constructor.get_data()
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 101, in get_data
    return self.construct_document(self.composer.get_node())
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 118, in construct_document
    for _dummy in generator:
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 671, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 398, in construct_mapping
    return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 230, in construct_mapping
    key_node.start_mark,
ruamel.yaml.constructor.ConstructorError: while constructing a mapping
found unacceptable key (unhashable type: 'dict')
  in "<byte string>", line 1, column 1:
    { first: Sammy, last: Sosa }:
    ^ (line: 1)

ruby-json

 na
{"{\"first\"=>\"Sammy\", \"last\"=>\"Sosa\"}":{"hr":65,"avg":0.278}}