# YAML Test Matrix

--- &test-9KAX
  Title: Various combinations of tags and anchors
  Tags: [ 1.3-err, anchor, mapping, tag ]

YAML

---
&a1
!!str
scalar1
---
!!str
&a2
scalar2
---
&a3
!!str scalar3
---
&a4 !!map
&a5 !!str key5: value4
---
a6: 1
&anchor6 b6: 2
---
!!map
&a8 !!str key8: value7
---
!!map
!!str &a10 key10: value9
---
!!str &a11
value11

Expected Events

+STR
+DOC ---
=VAL &a1 <tag:yaml.org,2002:str> :scalar1
-DOC
+DOC ---
=VAL &a2 <tag:yaml.org,2002:str> :scalar2
-DOC
+DOC ---
=VAL &a3 <tag:yaml.org,2002:str> :scalar3
-DOC
+DOC ---
+MAP &a4 <tag:yaml.org,2002:map>
=VAL &a5 <tag:yaml.org,2002:str> :key5
=VAL :value4
-MAP
-DOC
+DOC ---
+MAP
=VAL :a6
=VAL :1
=VAL &anchor6 :b6
=VAL :2
-MAP
-DOC
+DOC ---
+MAP <tag:yaml.org,2002:map>
=VAL &a8 <tag:yaml.org,2002:str> :key8
=VAL :value7
-MAP
-DOC
+DOC ---
+MAP <tag:yaml.org,2002:map>
=VAL &a10 <tag:yaml.org,2002:str> :key10
=VAL :value9
-MAP
-DOC
+DOC ---
=VAL &a11 <tag:yaml.org,2002:str> :value11
-DOC
-STR

Expected JSON

"scalar1"
"scalar2"
"scalar3"
{
"key5": "value4"
}
{
"a6": 1,
"b6": 2
}
{
"key8": "value7"
}
{
"key10": "value9"
}
"value11"

c-libfyaml-event

 ok

c-libyaml-event

 ok

cpp-yamlcpp-event

 ok

dotnet-yamldotnet-event

 ok

java-snakeyaml-event

 ok

js-yaml-event

 ok

nim-nimyaml-event

 ok

perl-pp-event

 ok

perl-pplibyaml-event

 ok

perl-refparser-event

 ok

py-pyyaml-event

 ok

py-ruamel-event

 ok

c-libfyaml-json

 json_ok

java-snakeyaml-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

dotnet-yamldotnet-json

 error
Unhandled exception. YamlDotNet.Core.YamlException: (Line: 5, Col: 1, Idx: 22) - (Line: 5, Col: 4, Idx: 25): Expected 'StreamEnd', got 'DocumentStart' (at Line: 5, Col: 1, Idx: 22).
   at YamlDotNet.Core.ParserExtensions.Require[T](IParser parser)
   at YamlDotNet.Core.ParserExtensions.Consume[T](IParser parser)
   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)

hs-hsyaml-event

 error
+STR
+DOC ---
=VAL &a1 <tag:yaml.org,2002:str> :scalar1
-DOC
+DOC ---
=VAL &a2 <tag:yaml.org,2002:str> :scalar2
-DOC
+DOC ---
=VAL &a3 <tag:yaml.org,2002:str> :scalar3
-DOC
+DOC ---
+MAP &a4 <tag:yaml.org,2002:map>
=VAL &a5 <tag:yaml.org,2002:str> :key5
=VAL :value4
-MAP
-DOC
+DOC ---
+MAP
=VAL :a6
=VAL :1
=VAL &anchor6 :b6
=VAL :2
-MAP
-DOC
+DOC ---
=VAL :
Parsing error near byte offset Pos {posByteOffset = 132, posCharOffset = 132, posLine = 19, posColumn = 0} (Lexical error near "!!map")

hs-hsyaml-json

 error
hsyaml-parser: user error (Lexical error near "!!map")

js-jsyaml-json

 error
/node/node_modules/js-yaml/lib/loader.js:187
  throw generateError(state, message);
  ^
YAMLException: duplication of an anchor property (14:1)

 11 | !!str scalar3
 12 | ---
 13 | &a4 !!map
 14 | &a5 !!str key5: value4
------^
 15 | ---
 16 | a6: 1
    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 readAnchorProperty (/node/node_modules/js-yaml/lib/loader.js:1317:5)
    at composeNode (/node/node_modules/js-yaml/lib/loader.js:1407:38)
    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 (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)

perl-syck-json

 error
Syck parser (line 4, column 0): 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 4, column 0): 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: 2
   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: 2
   Document: 2
 at /perl5/lib/perl5/YAML/Loader.pm line 88.

perl-pp-perl

 na
'scalar1'
'scalar2'
'scalar3'
{
  'key5' => 'value4'
}
{
  'a6' => 1,
  'b6' => 2
}
{
  'key8' => 'value7'
}
{
  'key10' => 'value9'
}
'value11'

perl-pplibyaml-perl

 na
'scalar1'
'scalar2'
'scalar3'
{
  'key5' => 'value4'
}
{
  'a6' => 1,
  'b6' => 2
}
{
  'key8' => 'value7'
}
{
  'key10' => 'value9'
}
'value11'

perl-xs-perl

 na
'scalar1'
'scalar2'
'scalar3'
{
  'key5' => 'value4'
}
{
  'a6' => 1,
  'b6' => 2
}
{
  'key8' => 'value7'
}
{
  'key10' => 'value9'
}
'value11'

py-pyyaml-py

 na
'scalar1'
'scalar2'
'scalar3'
{'key5': 'value4'}
{'a6': 1, 'b6': 2}
{'key8': 'value7'}
{'key10': 'value9'}
'value11'

py-ruamel-py

 na
'scalar1'
'scalar2'
'scalar3'
{'key5': 'value4'}
{'a6': 1, 'b6': 2}
{'key8': 'value7'}
{'key10': 'value9'}
'value11'

perl-tiny-json

 ni
YAML::Tiny failed to classify line '&a1' at /yaml/bin/perl-tiny-json line 12.

perl-tiny-perl

 ni
YAML::Tiny failed to classify line '&a1' at /yaml/bin/perl-tiny-perl line 15.