# YAML Test Matrix

--- &test-C4HZ
  Title: Spec Example 2.24. Global Tags
  Tags: [ alias, directive, local-tag, spec, tag ]

YAML

%TAG ! tag:clarkevans.com,2002:
--- !shape
  # Use the ! handle for presenting
  # tag:clarkevans.com,2002:circle
- !circle
  center: &ORIGIN {x: 73, y: 129}
  radius: 7
- !line
  start: *ORIGIN
  finish: { x: 89, y: 102 }
- !label
  start: *ORIGIN
  color: 0xFFEEBB
  text: Pretty vector drawing.

Expected Events

+STR
+DOC ---
+SEQ <tag:clarkevans.com,2002:shape>
+MAP <tag:clarkevans.com,2002:circle>
=VAL :center
+MAP {} &ORIGIN
=VAL :x
=VAL :73
=VAL :y
=VAL :129
-MAP
=VAL :radius
=VAL :7
-MAP
+MAP <tag:clarkevans.com,2002:line>
=VAL :start
=ALI *ORIGIN
=VAL :finish
+MAP {}
=VAL :x
=VAL :89
=VAL :y
=VAL :102
-MAP
-MAP
+MAP <tag:clarkevans.com,2002:label>
=VAL :start
=ALI *ORIGIN
=VAL :color
=VAL :0xFFEEBB
=VAL :text
=VAL :Pretty vector drawing.
-MAP
-SEQ
-DOC
-STR

Expected JSON

[
{
"center": {
"x": 73,
"y": 129
},
"radius": 7
},
{
"finish": {
"x": 89,
"y": 102
},
"start": {
"x": 73,
"y": 129
}
},
{
"color": 16772795,
"start": {
"x": 73,
"y": 129
},
"text": "Pretty vector drawing."
}
]

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

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

py-pyyaml-json

 json_ok

py-ruamel-json

 json_ok

ruby-psych-json

 json_ok

c-libfyaml-json

 json_diff
[
  {
    "center": {
      "x": 73,
      "y": 129
    },
    "radius": 7
  },
  {
    "finish": {
      "x": 89,
      "y": 102
    },
    "start": {
      "x": 73,
      "y": 129
    }
  },
  {
    "color": "0xFFEEBB",
    "start": {
      "x": 73,
      "y": 129
    },
    "text": "Pretty vector drawing."
  }
]

perl-syck-json

 json_diff
{
  "%TAG ! tag:clarkevans.com,2002": null
}
[
  {
    "center": {
      "1": 129,
      "x": 73
    },
    "radius": 7
  },
  {
    "finish": {
      "1": 102,
      "x": 89
    },
    "start": {
      "1": 129,
      "x": 73
    }
  },
  {
    "color": 16772795,
    "start": {
      "1": 129,
      "x": 73
    },
    "text": "Pretty vector drawing."
  }
]

perl-xs-json

 error
YAML::XS::Load Error: The problem:

    bad tag found for hash: 'tag:clarkevans.com,2002:circle'

was found at document: 1

perl-xs-perl

 error
YAML::XS::Load Error: The problem:

    bad tag found for hash: 'tag:clarkevans.com,2002:circle'

was found at document: 1

perl-yaml-json

 error
Use of uninitialized value in sprintf at /perl5/lib/perl5/YAML/Error.pm line 18, <> line 1.
YAML Error: Can't parse inline implicit value ''
   Code: YAML_PARSE_ERR_BAD_INLINE_IMPLICIT
   Line: 1
   Document: 1
 at /perl5/lib/perl5/YAML/Loader.pm line 607.

perl-yaml-perl

 error
Use of uninitialized value in sprintf at /perl5/lib/perl5/YAML/Error.pm line 18, <> line 1.
YAML Error: Can't parse inline implicit value ''
   Code: YAML_PARSE_ERR_BAD_INLINE_IMPLICIT
   Line: 1
   Document: 1
 at /perl5/lib/perl5/YAML/Loader.pm line 607.

perl-pp-perl

 na
[
  {
    'center' => {
                  'x' => 73,
                  'y' => 129
                },
    'radius' => 7
  },
  {
    'finish' => {
                  'x' => 89,
                  'y' => 102
                },
    'start' => $VAR1->[0]{'center'}
  },
  {
    'color' => 16772795,
    'start' => $VAR1->[0]{'center'},
    'text' => 'Pretty vector drawing.'
  }
]

perl-pplibyaml-perl

 na
[
  {
    'center' => {
                  'x' => 73,
                  'y' => 129
                },
    'radius' => 7
  },
  {
    'finish' => {
                  'x' => 89,
                  'y' => 102
                },
    'start' => $VAR1->[0]{'center'}
  },
  {
    'color' => 16772795,
    'start' => $VAR1->[0]{'center'},
    'text' => 'Pretty vector drawing.'
  }
]

perl-syck-perl

 na
{
  '%TAG ! tag:clarkevans.com,2002' => undef
}
[
  {
    'center' => {
                  '1' => 129,
                  'x' => 73
                },
    'radius' => 7
  },
  {
    'finish' => {
                  '1' => 102,
                  'x' => 89
                },
    'start' => $VAR2->[0]{'center'}
  },
  {
    'color' => 16772795,
    'start' => $VAR2->[0]{'center'},
    'text' => 'Pretty vector drawing.'
  }
]

py-pyyaml-py

 na
GenericSequence(tag='tag:clarkevans.com,2002:shape', content=[GenericMapping(tag='tag:clarkevans.com,2002:circle', content={'center': {'x': 73, 'y': 129}, 'radius': 7}), GenericMapping(tag='tag:clarkevans.com,2002:line', content={'start': {'x': 73, 'y': 129}, 'finish': {'x': 89, 'y': 102}}), GenericMapping(tag='tag:clarkevans.com,2002:label', content={'start': {'x': 73, 'y': 129}, 'color': 16772795, 'text': 'Pretty vector drawing.'})])

py-ruamel-py

 na
GenericSequence(tag='tag:clarkevans.com,2002:shape', content=[GenericMapping(tag='tag:clarkevans.com,2002:circle', content={'center': {'x': 73, 'y': 129}, 'radius': 7}), GenericMapping(tag='tag:clarkevans.com,2002:line', content={'start': {'x': 73, 'y': 129}, 'finish': {'x': 89, 'y': 102}}), GenericMapping(tag='tag:clarkevans.com,2002:label', content={'start': {'x': 73, 'y': 129}, 'color': 16772795, 'text': 'Pretty vector drawing.'})])

dotnet-yamldotnet-json

 ni
Unhandled exception. YamlDotNet.Core.YamlException: (Line: 2, Col: 5, Idx: 36) - (Line: 5, Col: 1, Idx: 114): Encountered an unresolved tag 'tag:clarkevans.com,2002:shape'
   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.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)

java-snakeyaml-json

 ni
Exception in thread "main" Can't construct a java object for tag:clarkevans.com,2002:shape; exception=Invalid tag: tag:clarkevans.com,2002:shape
 in 'reader', line 2, column 5:
    --- !shape
        ^

	at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:336)
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230)
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:220)
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:174)
	at org.yaml.snakeyaml.constructor.BaseConstructor.getData(BaseConstructor.java:139)
	at org.yaml.snakeyaml.Yaml$1.next(Yaml.java:514)
	at org.yaml.editor.Snake2Json.yamlToJson(Snake2Json.java:18)
	at org.yaml.editor.Snake2Json.main(Snake2Json.java:25)
Caused by: org.yaml.snakeyaml.error.YAMLException: Invalid tag: tag:clarkevans.com,2002:shape
	at org.yaml.snakeyaml.nodes.Tag.getClassName(Tag.java:125)
	at org.yaml.snakeyaml.constructor.Constructor.getClassForNode(Constructor.java:664)
	at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.getConstructor(Constructor.java:323)
	at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:332)
	... 7 more

js-jsyaml-json

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

 5 | - !circle
 6 |   center: &ORIGIN {x: 73, y: 129}
 7 |   radius: 7
 8 | - !line
-----^
 9 |   start: *ORIGIN
 10 |   finish: { x: 89, y: 102 }
    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 readBlockSequence (/node/node_modules/js-yaml/lib/loader.js:1008:5)
    at composeNode (/node/node_modules/js-yaml/lib/loader.js:1440: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)

perl-tiny-json

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

perl-tiny-perl

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