# YAML Test Matrix

--- &test-HMQ5
  Title: Spec Example 6.23. Node Properties
  Tags: [ alias, spec, tag ]

YAML

!!str &a1 "foo":
  !!str bar
&a2 baz : *a1

Expected Events

+STR
+DOC
+MAP
=VAL &a1 <tag:yaml.org,2002:str> "foo
=VAL <tag:yaml.org,2002:str> :bar
=VAL &a2 :baz
=ALI *a1
-MAP
-DOC
-STR

Expected JSON

{
"baz": "foo",
"foo": "bar"
}

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

dotnet-yamldotnet-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

js-jsyaml-json

 error
/node/node_modules/js-yaml/lib/loader.js:187
  throw generateError(state, message);
  ^
YAMLException: end of the stream or a document separator is expected (1:16)

 1 | !!str &a1 "foo":
--------------------^
 2 |   !!str bar
 3 | &a2 baz : *a1
    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 readDocument (/node/node_modules/js-yaml/lib/loader.js:1645:5)
    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)
    at Module._load (node:internal/modules/cjs/loader:1024:12) {
  reason: 'end of the stream or a document separator is expected',
  mark: {
    name: null,
    buffer: '!!str &a1 "foo":\n  !!str bar\n&a2 baz : *a1\n',
    position: 15,
    line: 0,
    column: 15,
    snippet: ' 1 | !!str &a1 "foo":\n' +
      '--------------------^\n' +
      ' 2 |   !!str bar\n' +
      ' 3 | &a2 baz : *a1'
  }
}

Node.js v20.13.1

perl-syck-json

 error
json text or perl structure exceeds maximum nesting level (max_depth set too low?) at /yaml/bin/perl-syck-json line 15.

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.

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 +PROP|
   1    0    0    0 +TAG |
   1    0    0    0 +HAND|
   1    0    0    0 =SYNX|!
   1    1    1    1 =SYNX|!
   1    2    2    2 -HAND|
   1    2    2    2 =META|str
   1    5    5    5 -TAG |
   1    5    5    5 =WSPC|.
   1    6    6    6 +ANCH|
   1    6    6    6 =SYNX|&
   1    7    7    7 =META|a1
   1    9    9    9 -ANCH|
   1    9    9    9 -PROP|
   1    9    9    9 =WSPC|.
   1   10   10   10 +VAL |
   1   10   10   10 =SYNX|"
   1   11   11   11 =TEXT|foo
   1   14   14   14 =SYNX|"
   1   15   15   15 -VAL |
   1   15   15   15 -NODE|
   1   15   15   15 =SYNX|:
   1   16   16   16 =EOL |\x0a
   2    0   17   17 =DENT|.
   2    1   18   18 =WSPC|.
   2    2   19   19 +NODE|
   2    2   19   19 +PROP|
   2    2   19   19 +TAG |
   2    2   19   19 +HAND|
   2    2   19   19 =SYNX|!
   2    3   20   20 =SYNX|!
   2    4   21   21 -HAND|
   2    4   21   21 =META|str
   2    7   24   24 -TAG |
   2    7   24   24 -PROP|
   2    7   24   24 =WSPC|.
   2    8   25   25 +VAL |
   2    8   25   25 =TEXT|bar
   2   11   28   28 -VAL |
   2   11   28   28 -NODE|
   2   11   28   28 =EOL |\x0a
   3    0   29   29 -PAIR|
   3    0   29   29 +PAIR|
   3    0   29   29 +NODE|
   3    0   29   29 +PROP|
   3    0   29   29 +ANCH|
   3    0   29   29 =SYNX|&
   3    1   30   30 =META|a2
   3    3   32   32 -ANCH|
   3    3   32   32 -PROP|
   3    3   32   32 =WSPC|.
   3    4   33   33 +VAL |
   3    4   33   33 =TEXT|baz
   3    7   36   36 -VAL |
   3    7   36   36 -NODE|
   3    7   36   36 =WSPC|.
   3    8   37   37 =SYNX|:
   3    9   38   38 =WSPC|.
   3   10   39   39 +NODE|
   3   10   39   39 +ALI |
   3   10   39   39 =SYNX|*
   3   11   40   40 =META|a1
   3   13   42   42 -ALI |
   3   13   42   42 -NODE|
   3   13   42   42 =EOL |\x0a
   4    0   43   43 -PAIR|
   4    0   43   43 -MAP |
   4    0   43   43 -NODE|
   4    0   43   43 -DOC |

perl-pp-perl

 na
{
  'baz' => 'foo',
  'foo' => 'bar'
}

perl-pplibyaml-perl

 na
{
  'baz' => 'foo',
  'foo' => 'bar'
}

perl-syck-perl

 na
{
  'baz' => $VAR1,
  'foo' => 'bar'
}

perl-xs-perl

 na
{
  'baz' => 'foo',
  'foo' => 'bar'
}

py-pyyaml-py

 na
{'baz': 'foo', 'foo': 'bar'}

py-ruamel-py

 na
{'baz': 'foo', 'foo': 'bar'}

perl-tiny-json

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

perl-tiny-perl

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