# YAML Test Matrix

--- &test-5TYM
  Title: Spec Example 6.21. Local Tag Prefix
  Tags: [ directive, local-tag, spec, tag ]

YAML

%TAG !m! !my-
--- # Bulb here
!m!light fluorescent
...
%TAG !m! !my-
--- # Color here
!m!light green

Expected Events

+STR
+DOC ---
=VAL <!my-light> :fluorescent
-DOC ...
+DOC ---
=VAL <!my-light> :green
-DOC
-STR

Expected JSON

"fluorescent"
"green"

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

perl-xs-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 <!my-light> :fluorescent
-DOC ...
+DOC ---
=VAL <!my-light> :green
-DOC
-STR
Transformed Events:
+STR
+DOC ---
=VAL <!my-light> :fluorescent
-DOC
+DOC ---
=VAL <!my-light> :green
-DOC
-STR
Got Events:
+STR
+DOC ---
=VAL <!my-light> :fluorescent
-DOC
+DOC ---
=VAL <!my-light> :green
-DOC
-STR

rust-yamlrust-event

 diff
Minimal Events:
+STR
+DOC
=VAL <!my-light> :fluorescent
-DOC
+DOC
=VAL <!my-light> :green
-DOC
-STR
Transformed Events:
+STR
+DOC
=VAL <!m!light> :fluorescent
-DOC
+DOC
=VAL <!m!light> :green
-DOC
-STR
Got Events:
+STR
+DOC
=VAL <!m!light> :fluorescent
-DOC
+DOC
=VAL <!m!light> :green
-DOC
-STR

perl-syck-json

 error
Syck parser (line 3, column 8): syntax error at /perl5/lib/perl5/x86_64-linux-thread-multi/YAML/Syck.pm line 60, <> line 1.

perl-syck-perl

 error
Syck parser (line 3, column 8): syntax error at /perl5/lib/perl5/x86_64-linux-thread-multi/YAML/Syck.pm line 60, <> line 1.

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 =META|m
   1    7    7    7 =SYNX|!
   1    8    8    8 -HAND|
   1    8    8    8 =WSPC|.
   1    9    9    9 +TAG |
   1    9    9    9 =SYNX|!
   1   10   10   10 =META|my-
   1   13   13   13 -TAG |
   1   13   13   13 -DIR |
   1   13   13   13 =EOL |\x0a
   2    0   14   14 =HEAD|---
   2    3   17   17 =WSPC|.
   2    4   18   18 +COMM|
   2    4   18   18 =SYNX|#
   2    5   19   19 =META|.Bulb.here
   2   15   29   29 -COMM|
   2   15   29   29 =EOL |\x0a
   3    0   30   30 +NODE|
   3    0   30   30 +PROP|
   3    0   30   30 +TAG |
   3    0   30   30 +HAND|
   3    0   30   30 =SYNX|!
   3    1   31   31 =META|m
   3    2   32   32 =SYNX|!
   3    3   33   33 -HAND|
   3    3   33   33 =META|light
   3    8   38   38 -TAG |
   3    8   38   38 -PROP|
   3    8   38   38 =WSPC|.
   3    9   39   39 +VAL |
   3    9   39   39 =TEXT|fluorescent
   3   20   50   50 -VAL |
   3   20   50   50 -NODE|
   3   20   50   50 =EOL |\x0a
   4    0   51   51 -DOC |
   4    0   51   51 =FOOT|...
   4    3   54   54 =EOL |\x0a
   5    0   55   55 +DOC |
   5    0   55   55 +DIR |
   5    0   55   55 =SYNX|%
   5    1   56   56 =META|TAG
   5    4   59   59 =WSPC|.
   5    5   60   60 +HAND|
   5    5   60   60 =SYNX|!
   5    6   61   61 =META|m
   5    7   62   62 =SYNX|!
   5    8   63   63 -HAND|
   5    8   63   63 =WSPC|.
   5    9   64   64 +TAG |
   5    9   64   64 =SYNX|!
   5   10   65   65 =META|my-
   5   13   68   68 -TAG |
   5   13   68   68 -DIR |
   5   13   68   68 =EOL |\x0a
   6    0   69   69 =HEAD|---
   6    3   72   72 =WSPC|.
   6    4   73   73 +COMM|
   6    4   73   73 =SYNX|#
   6    5   74   74 =META|.Color.here
   6   16   85   85 -COMM|
   6   16   85   85 =EOL |\x0a
   7    0   86   86 +NODE|
   7    0   86   86 +PROP|
   7    0   86   86 +TAG |
   7    0   86   86 +HAND|
   7    0   86   86 =SYNX|!
   7    1   87   87 =META|m
   7    2   88   88 =SYNX|!
   7    3   89   89 -HAND|
   7    3   89   89 =META|light
   7    8   94   94 -TAG |
   7    8   94   94 -PROP|
   7    8   94   94 =WSPC|.
   7    9   95   95 +VAL |
   7    9   95   95 =TEXT|green
   7   14  100  100 -VAL |
   7   14  100  100 -NODE|
   7   14  100  100 =EOL |\x0a
   8    0  101  101 -DOC |

perl-pp-perl

 na
'fluorescent'
'green'

perl-pplibyaml-perl

 na
'fluorescent'
'green'

perl-xs-perl

 na
'fluorescent'
'green'

py-pyyaml-py

 na
GenericScalar(tag='!my-light', content='fluorescent')
GenericScalar(tag='!my-light', content='green')

py-ruamel-py

 na
GenericScalar(tag='!my-light', content='fluorescent')
GenericScalar(tag='!my-light', content='green')

dotnet-yamldotnet-json

 ni
Unhandled exception. YamlDotNet.Core.YamlException: (Line: 3, Col: 1, Idx: 30) - (Line: 3, Col: 21, Idx: 50): Encountered an unresolved tag '!my-light'
   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 !<!my-light> (4:1)

 1 | %TAG !m! !my-
 2 | --- # Bulb here
 3 | !m!light fluorescent
 4 | ...
-----^
 5 | %TAG !m! !my-
 6 | --- # Color here
    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 !<!my-light>',
  mark: {
    name: null,
    buffer: '%TAG !m! !my-\n' +
      '--- # Bulb here\n' +
      '!m!light fluorescent\n' +
      '...\n' +
      '%TAG !m! !my-\n' +
      '--- # Color here\n' +
      '!m!light green\n',
    position: 51,
    line: 3,
    column: 0,
    snippet: ' 1 | %TAG !m! !my-\n' +
      ' 2 | --- # Bulb here\n' +
      ' 3 | !m!light fluorescent\n' +
      ' 4 | ...\n' +
      '-----^\n' +
      ' 5 | %TAG !m! !my-\n' +
      ' 6 | --- # Color here'
  }
}

Node.js v20.13.1

perl-tiny-json

 ni
YAML::Tiny failed to classify line '%TAG !m! !my-' at /yaml/bin/perl-tiny-json line 12.

perl-tiny-perl

 ni
YAML::Tiny failed to classify line '%TAG !m! !my-' at /yaml/bin/perl-tiny-perl line 15.