# YAML Test Matrix

--- &test-CUP7
  Title: Spec Example 5.6. Node Property Indicators
  Tags: [ alias, local-tag, spec, tag ]

YAML

anchored: !local &anchor value
alias: *anchor

Expected Events

+STR
+DOC
+MAP
=VAL :anchored
=VAL &anchor <!local> :value
=VAL :alias
=ALI *anchor
-MAP
-DOC
-STR

Expected JSON

{
"alias": "value",
"anchored": "value"
}

c-libfyaml-event

 ok

c-libyaml-event

 ok

cpp-rapidyaml-event

 ok

cpp-yamlcpp-event

 ok

dotnet-yamldotnet-event

 ok

hs-hsyaml-event

 ok

js-yaml-event

 ok

nim-nimyaml-event

 ok

perl-pp-event

 ok

perl-refparser-event

 ok

py-pyyaml-event

 ok

py-ruamel-event

 ok

rust-yamlrust-event

 ok

c-libfyaml-json

 json_ok

go-yaml-json

 json_ok

hs-hsyaml-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

perl-yaml-json

 json_ok

py-pyyaml-json

 json_ok

py-ruamel-json

 json_ok

ruby-psych-json

 json_ok

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 +VAL |
   1    0    0    0 =TEXT|anchored
   1    8    8    8 -VAL |
   1    8    8    8 -NODE|
   1    8    8    8 =SYNX|:
   1    9    9    9 =WSPC|.
   1   10   10   10 +NODE|
   1   10   10   10 +PROP|
   1   10   10   10 +TAG |
   1   10   10   10 +HAND|
   1   10   10   10 =SYNX|!
   1   11   11   11 -HAND|
   1   11   11   11 =META|local
   1   16   16   16 -TAG |
   1   16   16   16 =WSPC|.
   1   17   17   17 +ANCH|
   1   17   17   17 =SYNX|&
   1   18   18   18 =META|anchor
   1   24   24   24 -ANCH|
   1   24   24   24 -PROP|
   1   24   24   24 =WSPC|.
   1   25   25   25 +VAL |
   1   25   25   25 =TEXT|value
   1   30   30   30 -VAL |
   1   30   30   30 -NODE|
   1   30   30   30 =EOL |\x0a
   2    0   31   31 -PAIR|
   2    0   31   31 +PAIR|
   2    0   31   31 +NODE|
   2    0   31   31 +VAL |
   2    0   31   31 =TEXT|alias
   2    5   36   36 -VAL |
   2    5   36   36 -NODE|
   2    5   36   36 =SYNX|:
   2    6   37   37 =WSPC|.
   2    7   38   38 +NODE|
   2    7   38   38 +ALI |
   2    7   38   38 =SYNX|*
   2    8   39   39 =META|anchor
   2   14   45   45 -ALI |
   2   14   45   45 -NODE|
   2   14   45   45 =EOL |\x0a
   3    0   46   46 -PAIR|
   3    0   46   46 -MAP |
   3    0   46   46 -NODE|
   3    0   46   46 -DOC |

perl-pp-perl

 na
{
  'alias' => 'value',
  'anchored' => 'value'
}

perl-pplibyaml-perl

 na
{
  'alias' => 'value',
  'anchored' => 'value'
}

perl-syck-perl

 na
{
  'alias' => 'value',
  'anchored' => 'value'
}

perl-xs-perl

 na
{
  'alias' => 'value',
  'anchored' => ${\$VAR1->{'alias'}}
}

perl-yaml-perl

 na
{
  'alias' => 'value',
  'anchored' => 'value'
}

py-pyyaml-py

 na
{'alias': GenericScalar(tag='!local', content='value'),
 'anchored': GenericScalar(tag='!local', content='value')}

py-ruamel-py

 na
{'alias': GenericScalar(tag='!local', content='value'),
 'anchored': GenericScalar(tag='!local', content='value')}

dotnet-yamldotnet-json

 ni
Unhandled exception. YamlDotNet.Core.YamlException: (Line: 1, Col: 11, Idx: 10) - (Line: 1, Col: 31, Idx: 30): Encountered an unresolved tag '!local'
   at YamlDotNet.Serialization.NodeTypeResolvers.PreventUnknownTagsNodeTypeResolver.YamlDotNet.Serialization.INodeTypeResolver.Resolve(NodeEvent nodeEvent, Type& currentType)
   at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.GetTypeFromEvent(NodeEvent nodeEvent, Type currentType)
   at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
   at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
   at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.<>c__DisplayClass3_0.<DeserializeValue>b__0(IParser r, Type t)
   at YamlDotNet.Serialization.NodeDeserializers.DictionaryNodeDeserializer.DeserializeHelper(Type tKey, Type tValue, IParser parser, Func`3 nestedObjectDeserializer, IDictionary result)
   at YamlDotNet.Serialization.NodeDeserializers.DictionaryNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func`3 nestedObjectDeserializer, Object& value)
   at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
   at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
   at YamlDotNet.Serialization.Deserializer.Deserialize(IParser parser, Type type)
   at YamlDotNet.Serialization.Deserializer.Deserialize(TextReader input, Type type)
   at YamlDotNet.Serialization.Deserializer.Deserialize(TextReader input)
   at Program.Main(String[] commandLineArguments)
Aborted (core dumped)

js-jsyaml-json

 ni
/node/node_modules/js-yaml/lib/loader.js:187
  throw generateError(state, message);
  ^
YAMLException: unknown tag !<!local> (1:31)

 1 | anchored: !local &anchor value
-----------------------------------^
 2 | alias: *anchor
    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 composeNode (/node/node_modules/js-yaml/lib/loader.js:1521:7)
    at readBlockMapping (/node/node_modules/js-yaml/lib/loader.js:1164:11)
    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 (node:internal/modules/cjs/loader:1358:14) {
  reason: 'unknown tag !<!local>',
  mark: {
    name: null,
    buffer: 'anchored: !local &anchor value\nalias: *anchor\n',
    position: 30,
    line: 0,
    column: 30,
    snippet: ' 1 | anchored: !local &anchor value\n' +
      '-----------------------------------^\n' +
      ' 2 | alias: *anchor'
  }
}

Node.js v20.13.1

perl-tiny-json

 ni
YAML::Tiny does not support a feature in line '!local &anchor value' at /yaml/bin/perl-tiny-json line 12.

perl-tiny-perl

 ni
YAML::Tiny does not support a feature in line '!local &anchor value' at /yaml/bin/perl-tiny-perl line 15.