# YAML Test Matrix

--- &test-Q9WF
  Title: Spec Example 6.12. Separation Spaces
  Tags: [ 1.3-err, comment, complex-key, flow, 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



c-libfyaml-event

 ok

c-libyaml-event

 ok

cpp-yamlcpp-event

 ok

dotnet-yamldotnet-event

 ok

hs-hsyaml-event

 ok

java-snakeengine-event

 ok

java-snakeyaml-event

 ok

js-yaml-event

 ok

nim-nimyaml-event

 ok

perl-refparser-event

 ok

py-pyyaml-event

 ok

py-ruamel-event

 ok

rust-yamlrust-event

 ok

cpp-rapidyaml-event

 error
-:3:1: (44B): ERROR: parse error: incorrect indentation?
-:3:1:   hr:  # Home runs  (size=18)
       ^~~~~~~~~~~~~~~~~~  (cols 1-19)

perl-pp-event

 error
+STR
+DOC
+MAP {}
=VAL :first
=VAL :Sammy
=VAL :last
=VAL :Sosa
-MAP
Line      : 1
Column    : 29
Expected  : EOL
Got       : COLON
Where     : /perl5/lib/perl5/YAML/PP/Parser.pm line 392
YAML      : ":"
  at /yaml/bin/perl-pp-event line 25.

perl-pp-perl

 error
Line      : 1
Column    : 29
Expected  : EOL
Got       : COLON
Where     : /perl5/lib/perl5/YAML/PP/Parser.pm line 392
YAML      : ":"
  at /perl5/lib/perl5/YAML/PP/Loader.pm line 94.

perl-syck-perl

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

perl-yaml-perl

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

py-pyyaml-py

 error
Traceback (most recent call last):
  File "/yaml/bin/py-pyyaml-py", line 36, in <module>
    for doc in yaml.load_all(sys.stdin.read(), Loader=yaml.FullLoader):
  File "/python/lib/python3.7/site-packages/yaml/__init__.py", line 93, in load_all
    yield loader.get_data()
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 45, in get_data
    return self.construct_document(self.get_node())
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 60, in construct_document
    for dummy in generator:
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 413, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 218, in construct_mapping
    return super().construct_mapping(node, deep=deep)
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 142, in construct_mapping
    "found unhashable key", key_node.start_mark)
yaml.constructor.ConstructorError: while constructing a mapping
found unhashable key
  in "<unicode string>", line 1, column 1:
    { first: Sammy, last: Sosa }:
    ^

py-ruamel-py

 error
Traceback (most recent call last):
  File "/yaml/bin/py-ruamel-py", line 36, in <module>
    for doc in ruamel.yaml.load_all(sys.stdin.read(), Loader=ruamel.yaml.Loader):
  File "/python/lib/python3.7/site-packages/ruamel/yaml/main.py", line 1097, in load_all
    yield loader._constructor.get_data()
  File "/python/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 114, in get_data
    return self.construct_document(self.composer.get_node())
  File "/python/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 131, in construct_document
    for _dummy in generator:
  File "/python/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 674, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/python/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 445, in construct_mapping
    return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "/python/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 258, in construct_mapping
    key_node.start_mark,
ruamel.yaml.constructor.ConstructorError: while constructing a mapping
found unhashable key
  in "<unicode string>", line 1, column 1:
    { first: Sammy, last: Sosa }:
    ^ (line: 1)

raku-yamlish-raku

 error
Couldn't parse YAML
  in sub load-yamls at /raku/sources/44795C7AB0F35700F4CA9C3E2CC5C924EE4C608F (YAMLish) line 959
  in block <unit> at /yaml/bin/raku-yamlish-raku line 6

c-libfyaml-json

 na
{
stdin:1:1: error: Non scalar keys are not allowed in JSON emit mode
{ first: Sammy, last: Sosa }:
^~~~~~~~~~~~~~~~~~~~~~~~~~~~

dotnet-yamldotnet-json

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

go-yaml-json

 na
yaml: invalid map key: map[interface {}]interface {}{"first":"Sammy", "last":"Sosa"}

hs-hsyaml-json

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

hs-reference-yeast

 na
Line  Col Char Byte Token|Content
   1    0    0    0 +DOC |
   1    0    0    0 +NODE|
   1    0    0    0 +MAP |
   1    0    0    0 +PAIR|
   1    0    0    0 +NODE|
   1    0    0    0 +MAP |
   1    0    0    0 =SYNX|{
   1    1    1    1 =WSPC|.
   1    2    2    2 +PAIR|
   1    2    2    2 +NODE|
   1    2    2    2 +VAL |
   1    2    2    2 =TEXT|first
   1    7    7    7 -VAL |
   1    7    7    7 -NODE|
   1    7    7    7 =SYNX|:
   1    8    8    8 =WSPC|.
   1    9    9    9 +NODE|
   1    9    9    9 +VAL |
   1    9    9    9 =TEXT|Sammy
   1   14   14   14 -VAL |
   1   14   14   14 -NODE|
   1   14   14   14 -PAIR|
   1   14   14   14 =SYNX|,
   1   15   15   15 =WSPC|.
   1   16   16   16 +PAIR|
   1   16   16   16 +NODE|
   1   16   16   16 +VAL |
   1   16   16   16 =TEXT|last
   1   20   20   20 -VAL |
   1   20   20   20 -NODE|
   1   20   20   20 =SYNX|:
   1   21   21   21 =WSPC|.
   1   22   22   22 +NODE|
   1   22   22   22 +VAL |
   1   22   22   22 =TEXT|Sosa
   1   26   26   26 -VAL |
   1   26   26   26 -NODE|
   1   26   26   26 -PAIR|
   1   26   26   26 =WSPC|.
   1   27   27   27 =SYNX|}
   1   28   28   28 -MAP |
   1   28   28   28 -NODE|
   1   28   28   28 =SYNX|:
   1   29   29   29 +NODE|
   1   29   29   29 =EOL |\x0a
   2    0   30   30 +COMM|
   2    0   30   30 =SYNX|#
   2    1   31   31 =META|.Statistics:
   2   13   43   43 -COMM|
   2   13   43   43 =EOL |\x0a
   3    0   44   44 +MAP |
   3    0   44   44 =DENT|..
   3    2   46   46 +PAIR|
   3    2   46   46 +NODE|
   3    2   46   46 +VAL |
   3    2   46   46 =TEXT|hr
   3    4   48   48 -VAL |
   3    4   48   48 -NODE|
   3    4   48   48 =SYNX|:
   3    5   49   49 =WSPC|..
   3    7   51   51 +COMM|
   3    7   51   51 =SYNX|#
   3    8   52   52 =META|.Home.runs
   3   18   62   62 -COMM|
   3   18   62   62 =EOL |\x0a
   4    0   63   63 =DENT|...
   4    3   66   66 =WSPC|..
   4    5   68   68 +NODE|
   4    5   68   68 +VAL |
   4    5   68   68 =TEXT|65
   4    7   70   70 -VAL |
   4    7   70   70 -NODE|
   4    7   70   70 =EOL |\x0a
   5    0   71   71 -PAIR|
   5    0   71   71 =DENT|..
   5    2   73   73 +PAIR|
   5    2   73   73 +NODE|
   5    2   73   73 +VAL |
   5    2   73   73 =TEXT|avg
   5    5   76   76 -VAL |
   5    5   76   76 -NODE|
   5    5   76   76 =SYNX|:
   5    6   77   77 =WSPC|.
   5    7   78   78 +COMM|
   5    7   78   78 =SYNX|#
   5    8   79   79 =META|.Average
   5   16   87   87 -COMM|
   5   16   87   87 =EOL |\x0a
   6    0   88   88 =DENT|...
   6    3   91   91 +NODE|
   6    3   91   91 +VAL |
   6    3   91   91 =TEXT|0.278
   6    8   96   96 -VAL |
   6    8   96   96 -NODE|
   6    8   96   96 =EOL |\x0a
   7    0   97   97 -PAIR|
   7    0   97   97 -MAP |
   7    0   97   97 -NODE|
   7    0   97   97 -PAIR|
   7    0   97   97 -MAP |
   7    0   97   97 -NODE|
   7    0   97   97 -DOC |

java-snakeengine-json

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

java-snakeyaml-json

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

js-jsyaml-json

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

js-yaml-json

 na
{
  "{ first: Sammy, last: Sosa }": {
    "hr": 65,
    "avg": 0.278
  }
}
(node:3356) Warning: Keys with collection values will be stringified due to JS Object restrictions: "{ first: Sammy, last: Sosa }". Set mapAsMap: true to use object keys.

lua-lyaml-json

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

perl-pp-json

 na
Line      : 1
Column    : 29
Expected  : EOL
Got       : COLON
Where     : /perl5/lib/perl5/YAML/PP/Parser.pm line 392
YAML      : ":"
  at /perl5/lib/perl5/YAML/PP/Loader.pm line 94.

perl-pplibyaml-json

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

perl-pplibyaml-perl

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

perl-syck-json

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

perl-tiny-json

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

perl-xs-json

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

perl-xs-perl

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

perl-yaml-json

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

py-pyyaml-json

 na
Traceback (most recent call last):
  File "/yaml/bin/py-pyyaml-json", line 19, in <module>
    for doc in yaml.load_all(sys.stdin.read(), Loader=yaml.FullLoader):
  File "/python/lib/python3.7/site-packages/yaml/__init__.py", line 93, in load_all
    yield loader.get_data()
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 45, in get_data
    return self.construct_document(self.get_node())
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 60, in construct_document
    for dummy in generator:
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 413, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 218, in construct_mapping
    return super().construct_mapping(node, deep=deep)
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 142, in construct_mapping
    "found unhashable key", key_node.start_mark)
yaml.constructor.ConstructorError: while constructing a mapping
found unhashable key
  in "<unicode string>", line 1, column 1:
    { first: Sammy, last: Sosa }:
    ^

py-ruamel-json

 na
Traceback (most recent call last):
  File "/yaml/bin/py-ruamel-json", line 19, in <module>
    for doc in ruamel.yaml.load_all(sys.stdin.read(), Loader=ruamel.yaml.Loader):
  File "/python/lib/python3.7/site-packages/ruamel/yaml/main.py", line 1097, in load_all
    yield loader._constructor.get_data()
  File "/python/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 114, in get_data
    return self.construct_document(self.composer.get_node())
  File "/python/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 131, in construct_document
    for _dummy in generator:
  File "/python/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 674, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/python/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 445, in construct_mapping
    return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "/python/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 258, in construct_mapping
    key_node.start_mark,
ruamel.yaml.constructor.ConstructorError: while constructing a mapping
found unhashable key
  in "<unicode string>", line 1, column 1:
    { first: Sammy, last: Sosa }:
    ^ (line: 1)

raku-yamlish-json

 na
Couldn't parse YAML
  in sub load-yamls at /raku/sources/44795C7AB0F35700F4CA9C3E2CC5C924EE4C608F (YAMLish) line 959
  in block <unit> at /yaml/bin/raku-yamlish-json line 6

ruby-psych-json

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

perl-tiny-perl

 ni
YAML::Tiny found illegal characters in plain scalar: 'Sammy, last: Sosa }:' at /yaml/bin/perl-tiny-perl line 15.