# YAML Test Matrix

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

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"

cpp-event

 ok

java-event

 ok

js-event

 ok

libyaml-event

 ok

nimyaml-event

 ok

perl5-pp-event

 ok

pyyaml-event

 ok

ruamel-event

 ok

java-json

 json_ok

js-json

 json_ok

luajit-json

 json_ok

perl5-pp-json

 json_ok

perl5-xs-json

 json_ok

pyyaml-json

 json_ok

ruamel-json

 json_ok

ruby-json

 json_ok

hs-yaml-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-yaml-json

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

js-yaml-json

 error
YAMLException: duplication of an anchor property at line 14, column 1:
    &a5 !!str key5: value4
    ^
    at generateError (/node_modules/js-yaml/lib/js-yaml/loader.js:165:10)
    at throwError (/node_modules/js-yaml/lib/js-yaml/loader.js:171:9)
    at readAnchorProperty (/node_modules/js-yaml/lib/js-yaml/loader.js:1209:5)
    at composeNode (/node_modules/js-yaml/lib/js-yaml/loader.js:1298:38)
    at readDocument (/node_modules/js-yaml/lib/js-yaml/loader.js:1492:3)
    at loadDocuments (/node_modules/js-yaml/lib/js-yaml/loader.js:1548:5)
    at Object.loadAll (/node_modules/js-yaml/lib/js-yaml/loader.js:1556:19)
    at Object.<anonymous> (/bin/js-yaml-json:6:6)
    at Object.<anonymous> (/bin/js-yaml-json:3:1)
    at Module._compile (module.js:652:30)
    at Object.exports.run (/usr/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:173:23)
    at compileScript (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:224:29)
    at compilePath (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:174:14)
    at Object.exports.run (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:98:20)
    at Object.<anonymous> (/usr/lib/node_modules/coffee-script/bin/coffee:15:45)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3

perl5-pegex-event

 error
Error parsing Pegex document:
  msg:      Parse document failed for some reason
  line:     4
  column:   0
  context:  scalar1\n---\n!!str\n&a2\nscalar2\n---\n&a3\n!!str scalar3\n---\n&
                   ^
  position: 21 (0 pre-lookahead)
 at /bin/perl5-pegex-event line 23.

perl5-pm-json

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

perl5-pm-pl

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

perl5-syck-json

 error
Syck parser (line 4, column 0): syntax error at /lib/perl5/x86_64-linux-gnu-thread-multi/YAML/Syck.pm line 75, <> line 1.

perl5-syck-pl

 error
Syck parser (line 4, column 0): syntax error at /lib/perl5/x86_64-linux-gnu-thread-multi/YAML/Syck.pm line 75, <> line 1.

perl5-tiny-json

 error
YAML::Tiny failed to classify line '&a1' at /bin/perl5-tiny-json line 12.

perl5-tiny-pl

 error
YAML::Tiny failed to classify line '&a1' at /bin/perl5-tiny-pl line 15.

perl5-pp-pl

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

perl5-xs-pl

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

pyyaml-py

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

ruamel-py

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