# YAML Test Matrix

--- &test-Z67P
  Title: Spec Example 8.21. Block Scalar Nodes [1.3]
  Tags: [ 1.3-mod, folded, indent, literal, local-tag, spec, tag ]

YAML

literal: |2
  value
folded: !foo >1
 value

Expected Events

+STR
+DOC
+MAP
=VAL :literal
=VAL |value\n
=VAL :folded
=VAL <!foo> >value\n
-MAP
-DOC
-STR

Expected JSON

{
"folded": "value\n",
"literal": "value\n"
}

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

rust-yamlrust-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-syck-json

 json_ok

perl-xs-json

 json_ok

perl-yaml-json

 json_ok

py-pyyaml-json

 json_ok

py-ruamel-json

 json_ok

ruby-psych-json

 json_ok

hs-reference-yeast

 na
Line  Col Char Byte Token|Content
   1    0    0    0 +DOC |
   1    0    0    0 +NODE|
   1    0    0    0 +MAP |
   1    0    0    0 +PAIR|
   1    0    0    0 +NODE|
   1    0    0    0 +VAL |
   1    0    0    0 =TEXT|literal
   1    7    7    7 -VAL |
   1    7    7    7 -NODE|
   1    7    7    7 =SYNX|:
   1    8    8    8 +NODE|
   1    8    8    8 =WSPC|.
   1    9    9    9 +VAL |
   1    9    9    9 =SYNX||
   1   10   10   10 =SYNX|2
   1   11   11   11 =EOL |\x0a
   2    0   12   12 =DENT|..
   2    2   14   14 =TEXT|value
   2    7   19   19 =NEWL|\x0a
   3    0   20   20 -VAL |
   3    0   20   20 -NODE|
   3    0   20   20 -PAIR|
   3    0   20   20 +PAIR|
   3    0   20   20 +NODE|
   3    0   20   20 +VAL |
   3    0   20   20 =TEXT|folded
   3    6   26   26 -VAL |
   3    6   26   26 -NODE|
   3    6   26   26 =SYNX|:
   3    7   27   27 +NODE|
   3    7   27   27 =WSPC|.
   3    8   28   28 +PROP|
   3    8   28   28 +TAG |
   3    8   28   28 +HAND|
   3    8   28   28 =SYNX|!
   3    9   29   29 -HAND|
   3    9   29   29 =META|foo
   3   12   32   32 -TAG |
   3   12   32   32 -PROP|
   3   12   32   32 =WSPC|.
   3   13   33   33 +VAL |
   3   13   33   33 =SYNX|>
   3   14   34   34 =SYNX|1
   3   15   35   35 =EOL |\x0a
   4    0   36   36 =DENT|.
   4    1   37   37 =TEXT|value
   4    6   42   42 =NEWL|\x0a
   5    0   43   43 -VAL |
   5    0   43   43 -NODE|
   5    0   43   43 -PAIR|
   5    0   43   43 -MAP |
   5    0   43   43 -NODE|
   5    0   43   43 -DOC |

perl-pp-perl

 na
{
  'folded' => 'value
',
  'literal' => 'value
'
}

perl-pplibyaml-perl

 na
{
  'folded' => 'value
',
  'literal' => 'value
'
}

perl-syck-perl

 na
{
  'folded' => 'value
',
  'literal' => 'value
'
}

perl-xs-perl

 na
{
  'folded' => 'value
',
  'literal' => 'value
'
}

perl-yaml-perl

 na
{
  'folded' => 'value
',
  'literal' => 'value
'
}

py-pyyaml-py

 na
{'folded': GenericScalar(tag='!foo', content='value\n'), 'literal': 'value\n'}

py-ruamel-py

 na
{'folded': GenericScalar(tag='!foo', content='value\n'), 'literal': 'value\n'}

dotnet-yamldotnet-json

 ni
Unhandled exception. YamlDotNet.Core.YamlException: (Line: 3, Col: 9, Idx: 28) - (Line: 5, Col: 1, Idx: 43): 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.ValueDeserializers.NodeValueDeserializer.<>c__DisplayClass3_0.<DeserializeValue>b__0(IParser r, Type t)
   at YamlDotNet.Serialization.NodeDeserializers.DictionaryNodeDeserializer.DeserializeHelper(Type tKey, Type tValue, IParser parser, Func`3 nestedObjectDeserializer, IDictionary result)
   at YamlDotNet.Serialization.NodeDeserializers.DictionaryNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func`3 nestedObjectDeserializer, Object& value)
   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> (5:1)

 2 |   value
 3 | folded: !foo >1
 4 |  value
 5 | 
-----^
    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 readBlockMapping (/node/node_modules/js-yaml/lib/loader.js:1164:11)
    at composeNode (/node/node_modules/js-yaml/lib/loader.js:1441: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 !<!foo>',
  mark: {
    name: null,
    buffer: 'literal: |2\n  value\nfolded: !foo >1\n value\n',
    position: 43,
    line: 4,
    column: 0,
    snippet: ' 2 |   value\n 3 | folded: !foo >1\n 4 |  value\n 5 | \n-----^'
  }
}

Node.js v20.13.1

perl-tiny-json

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

perl-tiny-perl

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