# YAML Test Matrix

--- &test-6WLZ
  Title: Spec Example 6.18. Primary Tag Handle [1.3]
  Tags: [ 1.3-mod, directive, local-tag, spec, tag ]

YAML

# Private
---
!foo "bar"
...
# Global
%TAG ! tag:example.com,2000:app/
---
!foo "bar"

Expected Events

+STR
+DOC ---
=VAL <!foo> "bar
-DOC ...
+DOC ---
=VAL <tag:example.com,2000:app/foo> "bar
-DOC
-STR

Expected JSON

"bar"
"bar"

c-libfyaml-event

 ok

c-libyaml-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

cpp-rapidyaml-event

 diff
Minimal Events:
+STR
+DOC ---
=VAL <!foo> :bar
-DOC ...
+DOC ---
=VAL <tag:example.com,2000:app/foo> :bar
-DOC
-STR
Transformed Events:
+STR
+DOC ---
=VAL <!foo> :bar
-DOC
+DOC ---
=VAL <tag:example.com,2000:app/foo> :bar
-DOC
-STR
Got Events:
+STR
+DOC ---
=VAL <!foo> 'bar
-DOC
+DOC ---
=VAL <tag:example.com,2000:app/foo> 'bar
-DOC
-STR

rust-yamlrust-event

 diff
Minimal Events:
+STR
+DOC
=VAL <!foo> "bar
-DOC
+DOC
=VAL <tag:example.com,2000:app/foo> "bar
-DOC
-STR
Transformed Events:
+STR
+DOC
=VAL <!foo> "bar
-DOC
+DOC
=VAL <!foo> "bar
-DOC
-STR
Got Events:
+STR
+DOC
=VAL <!foo> "bar
-DOC
+DOC
=VAL <!foo> "bar
-DOC
-STR

perl-syck-json

 json_diff
"bar"
"%TAG ! tag:example.com,2000:app/ --- !foo \"bar\""

perl-xs-json

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

perl-xs-perl

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

perl-yaml-json

 error
YAML Error: Expected separator '---'
   Code: YAML_PARSE_ERR_NO_SEPARATOR
   Line: 3
   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: 3
   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 +COMM|
   1    0    0    0 =SYNX|#
   1    1    1    1 =META|.Private
   1    9    9    9 -COMM|
   1    9    9    9 =EOL |\x0a
   2    0   10   10 +DOC |
   2    0   10   10 =HEAD|---
   2    3   13   13 =EOL |\x0a
   3    0   14   14 +NODE|
   3    0   14   14 +PROP|
   3    0   14   14 +TAG |
   3    0   14   14 +HAND|
   3    0   14   14 =SYNX|!
   3    1   15   15 -HAND|
   3    1   15   15 =META|foo
   3    4   18   18 -TAG |
   3    4   18   18 -PROP|
   3    4   18   18 =WSPC|.
   3    5   19   19 +VAL |
   3    5   19   19 =SYNX|"
   3    6   20   20 =TEXT|bar
   3    9   23   23 =SYNX|"
   3   10   24   24 -VAL |
   3   10   24   24 -NODE|
   3   10   24   24 =EOL |\x0a
   4    0   25   25 -DOC |
   4    0   25   25 =FOOT|...
   4    3   28   28 =EOL |\x0a
   5    0   29   29 +COMM|
   5    0   29   29 =SYNX|#
   5    1   30   30 =META|.Global
   5    8   37   37 -COMM|
   5    8   37   37 =EOL |\x0a
   6    0   38   38 +DOC |
   6    0   38   38 +DIR |
   6    0   38   38 =SYNX|%
   6    1   39   39 =META|TAG
   6    4   42   42 =WSPC|.
   6    5   43   43 +HAND|
   6    5   43   43 =SYNX|!
   6    6   44   44 -HAND|
   6    6   44   44 =WSPC|.
   6    7   45   45 +TAG |
   6    7   45   45 =META|tag:example.com,2000:app/
   6   32   70   70 -TAG |
   6   32   70   70 -DIR |
   6   32   70   70 =EOL |\x0a
   7    0   71   71 =HEAD|---
   7    3   74   74 =EOL |\x0a
   8    0   75   75 +NODE|
   8    0   75   75 +PROP|
   8    0   75   75 +TAG |
   8    0   75   75 +HAND|
   8    0   75   75 =SYNX|!
   8    1   76   76 -HAND|
   8    1   76   76 =META|foo
   8    4   79   79 -TAG |
   8    4   79   79 -PROP|
   8    4   79   79 =WSPC|.
   8    5   80   80 +VAL |
   8    5   80   80 =SYNX|"
   8    6   81   81 =TEXT|bar
   8    9   84   84 =SYNX|"
   8   10   85   85 -VAL |
   8   10   85   85 -NODE|
   8   10   85   85 =EOL |\x0a
   9    0   86   86 -DOC |

perl-pp-perl

 na
'bar'
'bar'

perl-pplibyaml-perl

 na
'bar'
'bar'

perl-syck-perl

 na
'bar'
'%TAG ! tag:example.com,2000:app/ --- !foo "bar"'

py-pyyaml-py

 na
GenericScalar(tag='!foo', content='bar')
GenericScalar(tag='tag:example.com,2000:app/foo', content='bar')

py-ruamel-py

 na
GenericScalar(tag='!foo', content='bar')
GenericScalar(tag='tag:example.com,2000:app/foo', content='bar')

dotnet-yamldotnet-json

 ni
Unhandled exception. YamlDotNet.Core.YamlException: (Line: 3, Col: 1, Idx: 14) - (Line: 3, Col: 11, Idx: 24): Encountered an unresolved tag '!foo'
   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 !<!foo> (3:11)

 1 | # Private
 2 | ---
 3 | !foo "bar"
---------------^
 4 | ...
 5 | # Global
    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 !<!foo>',
  mark: {
    name: null,
    buffer: '# Private\n' +
      '---\n' +
      '!foo "bar"\n' +
      '...\n' +
      '# Global\n' +
      '%TAG ! tag:example.com,2000:app/\n' +
      '---\n' +
      '!foo "bar"\n',
    position: 24,
    line: 2,
    column: 10,
    snippet: ' 1 | # Private\n' +
      ' 2 | ---\n' +
      ' 3 | !foo "bar"\n' +
      '---------------^\n' +
      ' 4 | ...\n' +
      ' 5 | # Global'
  }
}

Node.js v20.13.1

perl-tiny-json

 ni
YAML::Tiny failed to classify line '!foo "bar"' at /yaml/bin/perl-tiny-json line 12.

perl-tiny-perl

 ni
YAML::Tiny failed to classify line '!foo "bar"' at /yaml/bin/perl-tiny-perl line 15.