# 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"
}
}

cpp-event

 ok

hs-yaml-event

 ok

java-event

 ok

libyaml-event

 ok

nimyaml-event

 ok

perl5-pp-event

 ok

pyyaml-event

 ok

ruamel-event

 ok

hs-yaml-json

 json_ok

java-json

 json_ok

luajit-json

 json_ok

perl5-pp-json

 json_ok

perl5-syck-json

 json_ok

perl5-xs-json

 json_ok

pyyaml-json

 json_ok

ruamel-json

 json_ok

ruby-json

 json_ok

js-yaml-json

 error
YAMLException: bad indentation of a mapping entry at line 12, column 19:
      &anchor6 'key6' : scalar6
                      ^
    at generateError (/node_modules/js-yaml/lib/js-yaml/loader.js:165:10)
    at throwError (/node_modules/js-yaml/lib/js-yaml/loader.js:171:9)
    at readBlockMapping (/node_modules/js-yaml/lib/js-yaml/loader.js:1080:7)
    at composeNode (/node_modules/js-yaml/lib/js-yaml/loader.js:1332:12)
    at readDocument (/node_modules/js-yaml/lib/js-yaml/loader.js:1492:3)
    at loadDocuments (/node_modules/js-yaml/lib/js-yaml/loader.js:1548:5)
    at Object.loadAll (/node_modules/js-yaml/lib/js-yaml/loader.js:1556:19)
    at Object.<anonymous> (/bin/js-yaml-json:6:6)
    at Object.<anonymous> (/bin/js-yaml-json:3:1)
    at Module._compile (module.js:410:26)
    at Object.exports.run (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:173:23)
    at compileScript (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:224:29)
    at compilePath (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:174:14)
    at Object.exports.run (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:98:20)
    at Object.<anonymous> (/usr/local/lib/node_modules/coffee-script/bin/coffee:15:45)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)
    at node.js:966:3

perl5-pegex-event

 error
Maximum parsing rules reached (1000)

perl5-pm-json

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

perl5-pm-pl

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

perl5-tiny-json

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

perl5-tiny-pl

 error
YAML::Tiny does not support a feature in line '&alias1 scalar1' at /bin/perl5-tiny-pl line 15.

perl5-pp-pl

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

perl5-syck-pl

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

perl5-xs-pl

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

pyyaml-py

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

ruamel-py

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