# YAML Test Matrix

--- &test-6KGN
  Title: Anchor for empty node
  Tags: [ alias, anchor ]

YAML

---
a: &anchor
b: *anchor

Expected Events

+STR
+DOC ---
+MAP
=VAL :a
=VAL &anchor :
=VAL :b
=ALI *anchor
-MAP
-DOC
-STR

Expected JSON

{
"a": null,
"b": null
}

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

perl5-pp-json

 json_ok

perl5-syck-json

 json_ok

pyyaml-json

 json_ok

ruamel-json

 json_ok

ruby-json

 json_ok

perl5-pegex-event

 diff
Got Events:
+STR
+DOC ---
+MAP
=VAL :a
=VAL &anchor :b
=VAL :
=ALI *anchor
-MAP
-DOC
-STR

java-json

 json_diff
{}

js-yaml-json

 json_diff
{
  "a": null,
  "b": []
}

luajit-json

 json_diff
{
  "a": "",
  "b": ""
}

js-json

 error
/node_modules/yaml/dist/schema/Alias.js:83
      if (this.cstNode) throw new _errors.YAMLReferenceError(this.cstNode, msg);else throw new ReferenceError(msg);
                                                                                     ^

ReferenceError: This should not happen: Alias anchor was not resolved?
    at Alias.toJSON (/node_modules/yaml/dist/schema/Alias.js:83:92)
    at toJSON (/node_modules/yaml/dist/toJSON.js:17:23)
    at Pair.addToJSMap (/node_modules/yaml/dist/schema/Pair.js:61:44)
    at YAMLMap.toJSON (/node_modules/yaml/dist/schema/Map.js:71:41)
    at toJSON (/node_modules/yaml/dist/toJSON.js:17:23)
    at Document.toJSON (/node_modules/yaml/dist/Document.js:563:32)
    at YAML.parseAllDocuments.map.doc (/bin/js-json:9:29)
    at Array.map (<anonymous>)
    at Object.<anonymous> (/bin/js-json:7:42)
    at Module._compile (module.js:652:30)

perl5-pm-json

 error
YAML Error: No anchor for alias '*anchor'
   Code: YAML_PARSE_ERR_NO_ANCHOR
   Line: 3
   Document: 1
 at /lib/perl5/YAML/Loader.pm line 152.

perl5-pm-pl

 error
YAML Error: No anchor for alias '*anchor'
   Code: YAML_PARSE_ERR_NO_ANCHOR
   Line: 3
   Document: 1
 at /lib/perl5/YAML/Loader.pm line 152.

perl5-tiny-json

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

perl5-tiny-pl

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

perl5-xs-json

 error
YAML::XS Error: No anchor for alias 'anchor' at /bin/perl5-xs-json line 14, <> line 1.

perl5-xs-pl

 error
YAML::XS Error: No anchor for alias 'anchor' at /bin/perl5-xs-pl line 16, <> line 1.

perl5-pp-pl

 na
{
  'a' => undef,
  'b' => undef
}

perl5-syck-pl

 na
{
  'a' => undef,
  'b' => undef
}

pyyaml-py

 na
{'a': None, 'b': None}

ruamel-py

 na
{'a': None, 'b': None}