# YAML Test Matrix

--- &test-26DV
  Title: Whitespace around colon in mappings
  Tags: [ alias, mapping, whitespace ]

YAML

"top1" : 
  "key1" : &alias1 scalar1
'top2' : 
  'key2' : &alias2 scalar2
top3: &node3 
  *alias1 : scalar3
top4: 
  *alias2 : scalar4
top5   :    
  scalar5
top6: 
  &anchor6 'key6' : scalar6

Expected Events

+STR
+DOC
+MAP
=VAL "top1
+MAP
=VAL "key1
=VAL &alias1 :scalar1
-MAP
=VAL 'top2
+MAP
=VAL 'key2
=VAL &alias2 :scalar2
-MAP
=VAL :top3
+MAP &node3
=ALI *alias1
=VAL :scalar3
-MAP
=VAL :top4
+MAP
=ALI *alias2
=VAL :scalar4
-MAP
=VAL :top5
=VAL :scalar5
=VAL :top6
+MAP
=VAL &anchor6 'key6
=VAL :scalar6
-MAP
-MAP
-DOC
-STR

Expected JSON

{
"top1": {
"key1": "scalar1"
},
"top2": {
"key2": "scalar2"
},
"top3": {
"scalar1": "scalar3"
},
"top4": {
"scalar2": "scalar4"
},
"top5": "scalar5",
"top6": {
"key6": "scalar6"
}
}

c-libfyaml-event

 ok

c-libyaml-event

 ok

cpp-yamlcpp-event

 ok

dotnet-yamldotnet-event

 ok

hs-hsyaml-event

 ok

java-snakeyaml-event

 ok

js-yaml-event

 ok

nim-nimyaml-event

 ok

perl-pp-event

 ok

perl-pplibyaml-event

 ok

perl-refparser-event

 ok

py-pyyaml-event

 ok

py-ruamel-event

 ok

c-libfyaml-json

 json_ok

dotnet-yamldotnet-json

 json_ok

hs-hsyaml-json

 json_ok

java-snakeyaml-json

 json_ok

js-yaml-json

 json_ok

lua-lyaml-json

 json_ok

perl-pp-json

 json_ok

perl-pplibyaml-json

 json_ok

perl-syck-json

 json_ok

perl-xs-json

 json_ok

py-pyyaml-json

 json_ok

py-ruamel-json

 json_ok

ruby-psych-json

 json_ok

js-jsyaml-json

 error
/node/node_modules/js-yaml/lib/loader.js:187
  throw generateError(state, message);
  ^
YAMLException: bad indentation of a mapping entry (12:19)

  9 | top5   :    
 10 |   scalar5
 11 | top6: 
 12 |   &anchor6 'key6' : scalar6
------------------------^
    at generateError (/node/node_modules/js-yaml/lib/loader.js:183:10)
    at throwError (/node/node_modules/js-yaml/lib/loader.js:187:9)
    at readBlockMapping (/node/node_modules/js-yaml/lib/loader.js:1182:7)
    at composeNode (/node/node_modules/js-yaml/lib/loader.js:1441:12)
    at readDocument (/node/node_modules/js-yaml/lib/loader.js:1625:3)
    at loadDocuments (/node/node_modules/js-yaml/lib/loader.js:1688:5)
    at Object.loadAll (/node/node_modules/js-yaml/lib/loader.js:1701:19)
    at Object.<anonymous> (/yaml/bin/js-jsyaml-json:7:13)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)

perl-yaml-json

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

perl-yaml-perl

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

perl-pp-perl

 na
{
  'top1' => {
              'key1' => 'scalar1'
            },
  'top2' => {
              'key2' => 'scalar2'
            },
  'top3' => {
              'scalar1' => 'scalar3'
            },
  'top4' => {
              'scalar2' => 'scalar4'
            },
  'top5' => 'scalar5',
  'top6' => {
              'key6' => 'scalar6'
            }
}

perl-pplibyaml-perl

 na
{
  'top1' => {
              'key1' => 'scalar1'
            },
  'top2' => {
              'key2' => 'scalar2'
            },
  'top3' => {
              'scalar1' => 'scalar3'
            },
  'top4' => {
              'scalar2' => 'scalar4'
            },
  'top5' => 'scalar5',
  'top6' => {
              'key6' => 'scalar6'
            }
}

perl-syck-perl

 na
{
  'top1' => {
              'key1' => 'scalar1'
            },
  'top2' => {
              'key2' => 'scalar2'
            },
  'top3' => {
              'scalar1' => 'scalar3'
            },
  'top4' => {
              'scalar2' => 'scalar4'
            },
  'top5' => 'scalar5',
  'top6' => {
              'key6' => 'scalar6'
            }
}

perl-xs-perl

 na
{
  'top1' => {
              'key1' => 'scalar1'
            },
  'top2' => {
              'key2' => 'scalar2'
            },
  'top3' => {
              'scalar1' => 'scalar3'
            },
  'top4' => {
              'scalar2' => 'scalar4'
            },
  'top5' => 'scalar5',
  'top6' => {
              'key6' => 'scalar6'
            }
}

py-pyyaml-py

 na
{'top1': {'key1': 'scalar1'},
 'top2': {'key2': 'scalar2'},
 'top3': {'scalar1': 'scalar3'},
 'top4': {'scalar2': 'scalar4'},
 'top5': 'scalar5',
 'top6': {'key6': 'scalar6'}}

py-ruamel-py

 na
{'top1': {'key1': 'scalar1'},
 'top2': {'key2': 'scalar2'},
 'top3': {'scalar1': 'scalar3'},
 'top4': {'scalar2': 'scalar4'},
 'top5': 'scalar5',
 'top6': {'key6': 'scalar6'}}

perl-tiny-json

 ni
YAML::Tiny does not support a feature in line '&alias1 scalar1' at /yaml/bin/perl-tiny-json line 12.

perl-tiny-perl

 ni
YAML::Tiny does not support a feature in line '&alias1 scalar1' at /yaml/bin/perl-tiny-perl line 15.