# YAML Test Matrix

--- &test-7BMT
  Title: Node and Mapping Key Anchors [1.3]
  Tags: [ 1.3-mod, anchor, comment ]

YAML

---
top1: &node1
  &k1 key1: one
top2: &node2 # comment
  key2: two
top3:
  &k3 key3: three
top4: &node4
  &k4 key4: four
top5: &node5
  key5: five
top6: &val6
  six
top7:
  &val7 seven

Expected Events

+STR
+DOC ---
+MAP
=VAL :top1
+MAP &node1
=VAL &k1 :key1
=VAL :one
-MAP
=VAL :top2
+MAP &node2
=VAL :key2
=VAL :two
-MAP
=VAL :top3
+MAP
=VAL &k3 :key3
=VAL :three
-MAP
=VAL :top4
+MAP &node4
=VAL &k4 :key4
=VAL :four
-MAP
=VAL :top5
+MAP &node5
=VAL :key5
=VAL :five
-MAP
=VAL :top6
=VAL &val6 :six
=VAL :top7
=VAL &val7 :seven
-MAP
-DOC
-STR

Expected JSON

{
"top1": {
"key1": "one"
},
"top2": {
"key2": "two"
},
"top3": {
"key3": "three"
},
"top4": {
"key4": "four"
},
"top5": {
"key5": "five"
},
"top6": "six",
"top7": "seven"
}

cpp-event

 ok

hs-yaml-event

 ok

java-event

 ok

js-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

js-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: duplication of an anchor property at line 3, column 3:
      &k1 key1: one
      ^
    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 readAnchorProperty (/node_modules/js-yaml/lib/js-yaml/loader.js:1209:5)
    at composeNode (/node_modules/js-yaml/lib/js-yaml/loader.js:1298:38)
    at readBlockMapping (/node_modules/js-yaml/lib/js-yaml/loader.js:1062:11)
    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:652:30)
    at Object.exports.run (/usr/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:173:23)
    at compileScript (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:224:29)
    at compilePath (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:174:14)
    at Object.exports.run (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:98:20)
    at Object.<anonymous> (/usr/lib/node_modules/coffee-script/bin/coffee:15:45)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3

perl5-pegex-event

 error
Maximum parsing rules reached (1000)

perl5-pm-json

 error
YAML Error: Inconsistent indentation level
   Code: YAML_PARSE_ERR_INCONSISTENT_INDENTATION
   Line: 5
   Document: 1
 at /lib/perl5/YAML/Loader.pm line 804.

perl5-pm-pl

 error
YAML Error: Inconsistent indentation level
   Code: YAML_PARSE_ERR_INCONSISTENT_INDENTATION
   Line: 5
   Document: 1
 at /lib/perl5/YAML/Loader.pm line 804.

perl5-tiny-json

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

perl5-tiny-pl

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

perl5-pp-pl

 na
{
  'top1' => {
            'key1' => 'one'
          },
  'top2' => {
            'key2' => 'two'
          },
  'top3' => {
            'key3' => 'three'
          },
  'top4' => {
            'key4' => 'four'
          },
  'top5' => {
            'key5' => 'five'
          },
  'top6' => 'six',
  'top7' => 'seven'
}

perl5-syck-pl

 na
{
  'top1' => {
            'key1' => 'one'
          },
  'top2' => {
            'key2' => 'two'
          },
  'top3' => {
            'key3' => 'three'
          },
  'top4' => {
            'key4' => 'four'
          },
  'top5' => {
            'key5' => 'five'
          },
  'top6' => 'six',
  'top7' => 'seven'
}

perl5-xs-pl

 na
{
  'top1' => {
              'key1' => 'one'
            },
  'top2' => {
              'key2' => 'two'
            },
  'top3' => {
              'key3' => 'three'
            },
  'top4' => {
              'key4' => 'four'
            },
  'top5' => {
              'key5' => 'five'
            },
  'top6' => 'six',
  'top7' => 'seven'
}

pyyaml-py

 na
{'top1': {'key1': 'one'},
 'top2': {'key2': 'two'},
 'top3': {'key3': 'three'},
 'top4': {'key4': 'four'},
 'top5': {'key5': 'five'},
 'top6': 'six',
 'top7': 'seven'}

ruamel-py

 na
{'top1': {'key1': 'one'},
 'top2': {'key2': 'two'},
 'top3': {'key3': 'three'},
 'top4': {'key4': 'four'},
 'top5': {'key5': 'five'},
 'top6': 'six',
 'top7': 'seven'}