# YAML Test Matrix

--- &test-P76L
  Title: Spec Example 6.19. Secondary Tag Handle
  Tags: [ header, spec, tag, unknown-tag ]

YAML

%TAG !! tag:example.com,2000:app/
---
!!int 1 - 3 # Interval, not integer

Expected Events

+STR
+DOC ---
=VAL <tag:example.com,2000:app/int> :1 - 3
-DOC
-STR

Expected JSON

"1 - 3"

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

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

py-pyyaml-json

 json_ok

py-ruamel-json

 json_ok

ruby-psych-json

 json_ok

rust-yamlrust-event

 diff
Minimal Events:
+STR
+DOC
=VAL <tag:example.com,2000:app/int> :1 - 3
-DOC
-STR
Transformed Events:
+STR
+DOC
=VAL <tag:yaml.org,2002:int> :1 - 3
-DOC
-STR
Got Events:
+STR
+DOC
=VAL <tag:yaml.org,2002:int> :1 - 3
-DOC
-STR

perl-syck-json

 json_diff
"%TAG !! tag:example.com,2000:app/ --- !!int 1 - 3"

perl-yaml-json

 error
YAML Error: Expected separator '---'
   Code: YAML_PARSE_ERR_NO_SEPARATOR
   Line: 1
   Document: 2
 at /perl5/lib/perl5/YAML/Loader.pm line 88.

perl-yaml-perl

 error
YAML Error: Expected separator '---'
   Code: YAML_PARSE_ERR_NO_SEPARATOR
   Line: 1
   Document: 2
 at /perl5/lib/perl5/YAML/Loader.pm line 88.

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 =SYNX|!
   1    7    7    7 -HAND|
   1    7    7    7 =WSPC|.
   1    8    8    8 +TAG |
   1    8    8    8 =META|tag:example.com,2000:app/
   1   33   33   33 -TAG |
   1   33   33   33 -DIR |
   1   33   33   33 =EOL |\x0a
   2    0   34   34 =HEAD|---
   2    3   37   37 =EOL |\x0a
   3    0   38   38 +NODE|
   3    0   38   38 +PROP|
   3    0   38   38 +TAG |
   3    0   38   38 +HAND|
   3    0   38   38 =SYNX|!
   3    1   39   39 =SYNX|!
   3    2   40   40 -HAND|
   3    2   40   40 =META|int
   3    5   43   43 -TAG |
   3    5   43   43 -PROP|
   3    5   43   43 =WSPC|.
   3    6   44   44 +VAL |
   3    6   44   44 =TEXT|1.-.3
   3   11   49   49 -VAL |
   3   11   49   49 -NODE|
   3   11   49   49 =WSPC|.
   3   12   50   50 +COMM|
   3   12   50   50 =SYNX|#
   3   13   51   51 =META|.Interval,.not.integer
   3   35   73   73 -COMM|
   3   35   73   73 =EOL |\x0a
   4    0   74   74 -DOC |

perl-pp-perl

 na
'1 - 3'

perl-pplibyaml-perl

 na
'1 - 3'

perl-syck-perl

 na
'%TAG !! tag:example.com,2000:app/ --- !!int 1 - 3'

py-pyyaml-py

 na
GenericScalar(tag='tag:example.com,2000:app/int', content='1 - 3')

py-ruamel-py

 na
GenericScalar(tag='tag:example.com,2000:app/int', content='1 - 3')

dotnet-yamldotnet-json

 ni
Unhandled exception. YamlDotNet.Core.YamlException: (Line: 3, Col: 1, Idx: 38) - (Line: 3, Col: 12, Idx: 49): Encountered an unresolved tag 'tag:example.com,2000:app/int'
   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:example.com,2000:app/int> (3:13)

 1 | %TAG !! tag:example.com,2000:app/
 2 | ---
 3 | !!int 1 - 3 # Interval, not integer
-----------------^
    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 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)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32) {
  reason: 'unknown tag !<tag:example.com,2000:app/int>',
  mark: {
    name: null,
    buffer: '%TAG !! tag:example.com,2000:app/\n' +
      '---\n' +
      '!!int 1 - 3 # Interval, not integer\n',
    position: 50,
    line: 2,
    column: 12,
    snippet: ' 1 | %TAG !! tag:example.com,2000:app/\n' +
      ' 2 | ---\n' +
      ' 3 | !!int 1 - 3 # Interval, not integer\n' +
      '-----------------^'
  }
}

Node.js v20.13.1

perl-tiny-json

 ni
YAML::Tiny failed to classify line '%TAG !! tag:example.com,2000:app/' at /yaml/bin/perl-tiny-json line 12.

perl-tiny-perl

 ni
YAML::Tiny failed to classify line '%TAG !! tag:example.com,2000:app/' at /yaml/bin/perl-tiny-perl line 15.

perl-xs-json

 ni
YAML::XS Error: bad tag found for scalar: 'tag:example.com,2000:app/int' at /yaml/bin/perl-xs-json line 14, <> line 1.

perl-xs-perl

 ni
YAML::XS Error: bad tag found for scalar: 'tag:example.com,2000:app/int' at /yaml/bin/perl-xs-perl line 16, <> line 1.