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

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

rust-yamlrust-event

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

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."
  }
]

go-yaml-json

 error
panic: interface conversion: interface {} is bool, not string

goroutine 1 [running]:
main.convert({0x4f8e60, 0xc0000646c0})
	/buildutils/go-yaml-json.go:17 +0x1c7
main.convert({0x4f8e60, 0xc000064690})
	/buildutils/go-yaml-json.go:17 +0x145
main.convert({0x4f32c0, 0xc00000c0d8})
	/buildutils/go-yaml-json.go:22 +0x1ec
main.main()
	/buildutils/go-yaml-json.go:45 +0x2a5

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.

hs-reference-yeast

 na
Line  Col Char Byte Token|Content
   1    0    0    0 +DOC |
   1    0    0    0 +DIR |
   1    0    0    0 =SYNX|%
   1    1    1    1 =META|TAG
   1    4    4    4 =WSPC|.
   1    5    5    5 +HAND|
   1    5    5    5 =SYNX|!
   1    6    6    6 -HAND|
   1    6    6    6 =WSPC|.
   1    7    7    7 +TAG |
   1    7    7    7 =META|tag:clarkevans.com,2002:
   1   31   31   31 -TAG |
   1   31   31   31 -DIR |
   1   31   31   31 =EOL |\x0a
   2    0   32   32 =HEAD|---
   2    3   35   35 +NODE|
   2    3   35   35 =WSPC|.
   2    4   36   36 +PROP|
   2    4   36   36 +TAG |
   2    4   36   36 +HAND|
   2    4   36   36 =SYNX|!
   2    5   37   37 -HAND|
   2    5   37   37 =META|shape
   2   10   42   42 -TAG |
   2   10   42   42 -PROP|
   2   10   42   42 =EOL |\x0a
   3    0   43   43 =WSPC|..
   3    2   45   45 +COMM|
   3    2   45   45 =SYNX|#
   3    3   46   46 =META|.Use.the.!.handle.for.presenting
   3   35   78   78 -COMM|
   3   35   78   78 =EOL |\x0a
   4    0   79   79 =WSPC|..
   4    2   81   81 +COMM|
   4    2   81   81 =SYNX|#
   4    3   82   82 =META|.tag:clarkevans.com,2002:circle
   4   34  113  113 -COMM|
   4   34  113  113 =EOL |\x0a
   5    0  114  114 +SEQ |
   5    0  114  114 =SYNX|-
   5    1  115  115 +NODE|
   5    1  115  115 =WSPC|.
   5    2  116  116 +PROP|
   5    2  116  116 +TAG |
   5    2  116  116 +HAND|
   5    2  116  116 =SYNX|!
   5    3  117  117 -HAND|
   5    3  117  117 =META|circle
   5    9  123  123 -TAG |
   5    9  123  123 -PROP|
   5    9  123  123 =EOL |\x0a
   6    0  124  124 +MAP |
   6    0  124  124 =DENT|..
   6    2  126  126 +PAIR|
   6    2  126  126 +NODE|
   6    2  126  126 +VAL |
   6    2  126  126 =TEXT|center
   6    8  132  132 -VAL |
   6    8  132  132 -NODE|
   6    8  132  132 =SYNX|:
   6    9  133  133 =WSPC|.
   6   10  134  134 +NODE|
   6   10  134  134 +PROP|
   6   10  134  134 +ANCH|
   6   10  134  134 =SYNX|&
   6   11  135  135 =META|ORIGIN
   6   17  141  141 -ANCH|
   6   17  141  141 -PROP|
   6   17  141  141 =WSPC|.
   6   18  142  142 +MAP |
   6   18  142  142 =SYNX|{
   6   19  143  143 +PAIR|
   6   19  143  143 +NODE|
   6   19  143  143 +VAL |
   6   19  143  143 =TEXT|x
   6   20  144  144 -VAL |
   6   20  144  144 -NODE|
   6   20  144  144 =SYNX|:
   6   21  145  145 =WSPC|.
   6   22  146  146 +NODE|
   6   22  146  146 +VAL |
   6   22  146  146 =TEXT|73
   6   24  148  148 -VAL |
   6   24  148  148 -NODE|
   6   24  148  148 -PAIR|
   6   24  148  148 =SYNX|,
   6   25  149  149 =WSPC|.
   6   26  150  150 +PAIR|
   6   26  150  150 +NODE|
   6   26  150  150 +VAL |
   6   26  150  150 =TEXT|y
   6   27  151  151 -VAL |
   6   27  151  151 -NODE|
   6   27  151  151 =SYNX|:
   6   28  152  152 =WSPC|.
   6   29  153  153 +NODE|
   6   29  153  153 +VAL |
   6   29  153  153 =TEXT|129
   6   32  156  156 -VAL |
   6   32  156  156 -NODE|
   6   32  156  156 -PAIR|
   6   32  156  156 =SYNX|}
   6   33  157  157 -MAP |
   6   33  157  157 -NODE|
   6   33  157  157 =EOL |\x0a
   7    0  158  158 -PAIR|
   7    0  158  158 =DENT|..
   7    2  160  160 +PAIR|
   7    2  160  160 +NODE|
   7    2  160  160 +VAL |
   7    2  160  160 =TEXT|radius
   7    8  166  166 -VAL |
   7    8  166  166 -NODE|
   7    8  166  166 =SYNX|:
   7    9  167  167 =WSPC|.
   7   10  168  168 +NODE|
   7   10  168  168 +VAL |
   7   10  168  168 =TEXT|7
   7   11  169  169 -VAL |
   7   11  169  169 -NODE|
   7   11  169  169 =EOL |\x0a
   8    0  170  170 -PAIR|
   8    0  170  170 -MAP |
   8    0  170  170 -NODE|
   8    0  170  170 =SYNX|-
   8    1  171  171 +NODE|
   8    1  171  171 =WSPC|.
   8    2  172  172 +PROP|
   8    2  172  172 +TAG |
   8    2  172  172 +HAND|
   8    2  172  172 =SYNX|!
   8    3  173  173 -HAND|
   8    3  173  173 =META|line
   8    7  177  177 -TAG |
   8    7  177  177 -PROP|
   8    7  177  177 =EOL |\x0a
   9    0  178  178 +MAP |
   9    0  178  178 =DENT|..
   9    2  180  180 +PAIR|
   9    2  180  180 +NODE|
   9    2  180  180 +VAL |
   9    2  180  180 =TEXT|start
   9    7  185  185 -VAL |
   9    7  185  185 -NODE|
   9    7  185  185 =SYNX|:
   9    8  186  186 =WSPC|.
   9    9  187  187 +NODE|
   9    9  187  187 +ALI |
   9    9  187  187 =SYNX|*
   9   10  188  188 =META|ORIGIN
   9   16  194  194 -ALI |
   9   16  194  194 -NODE|
   9   16  194  194 =EOL |\x0a
  10    0  195  195 -PAIR|
  10    0  195  195 =DENT|..
  10    2  197  197 +PAIR|
  10    2  197  197 +NODE|
  10    2  197  197 +VAL |
  10    2  197  197 =TEXT|finish
  10    8  203  203 -VAL |
  10    8  203  203 -NODE|
  10    8  203  203 =SYNX|:
  10    9  204  204 =WSPC|.
  10   10  205  205 +NODE|
  10   10  205  205 +MAP |
  10   10  205  205 =SYNX|{
  10   11  206  206 =WSPC|.
  10   12  207  207 +PAIR|
  10   12  207  207 +NODE|
  10   12  207  207 +VAL |
  10   12  207  207 =TEXT|x
  10   13  208  208 -VAL |
  10   13  208  208 -NODE|
  10   13  208  208 =SYNX|:
  10   14  209  209 =WSPC|.
  10   15  210  210 +NODE|
  10   15  210  210 +VAL |
  10   15  210  210 =TEXT|89
  10   17  212  212 -VAL |
  10   17  212  212 -NODE|
  10   17  212  212 -PAIR|
  10   17  212  212 =SYNX|,
  10   18  213  213 =WSPC|.
  10   19  214  214 +PAIR|
  10   19  214  214 +NODE|
  10   19  214  214 +VAL |
  10   19  214  214 =TEXT|y
  10   20  215  215 -VAL |
  10   20  215  215 -NODE|
  10   20  215  215 =SYNX|:
  10   21  216  216 =WSPC|.
  10   22  217  217 +NODE|
  10   22  217  217 +VAL |
  10   22  217  217 =TEXT|102
  10   25  220  220 -VAL |
  10   25  220  220 -NODE|
  10   25  220  220 -PAIR|
  10   25  220  220 =WSPC|.
  10   26  221  221 =SYNX|}
  10   27  222  222 -MAP |
----- 8< -----

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)

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 (node:internal/modules/cjs/loader:1358:14) {
  reason: 'unknown tag !<tag:clarkevans.com,2002:circle>',
  mark: {
    name: null,
    buffer: '%TAG ! tag:clarkevans.com,2002:\n' +
      '--- !shape\n' +
      '  # Use the ! handle for presenting\n' +
      '  # tag:clarkevans.com,2002:circle\n' +
      '- !circle\n' +
      '  center: &ORIGIN {x: 73, y: 129}\n' +
      '  radius: 7\n' +
      '- !line\n' +
      '  start: *ORIGIN\n' +
      '  finish: { x: 89, y: 102 }\n' +
      '- !label\n' +
      '  start: *ORIGIN\n' +
      '  color: 0xFFEEBB\n' +
      '  text: Pretty vector drawing.\n',
    position: 170,
    line: 7,
    column: 0,
    snippet: ' 5 | - !circle\n' +
      ' 6 |   center: &ORIGIN {x: 73, y: 129}\n' +
      ' 7 |   radius: 7\n' +
      ' 8 | - !line\n' +
      '-----^\n' +
      ' 9 |   start: *ORIGIN\n' +
      ' 10 |   finish: { x: 89, y: 102 }'
  }
}

Node.js v20.13.1

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.