# YAML Test Matrix

--- &test-WZ62
  Title: Spec Example 7.2. Empty Content
  Tags: [ flow, scalar, spec, tag ]

YAML

{
  foo : !!str,
  !!str : bar,
}

Expected Events

+STR
+DOC
+MAP {}
=VAL :foo
=VAL <tag:yaml.org,2002:str> :
=VAL <tag:yaml.org,2002:str> :
=VAL :bar
-MAP
-DOC
-STR

Expected JSON

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

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

c-libfyaml-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

ruby-psych-json

 json_ok

dotnet-yamldotnet-json

 error
Unhandled exception. YamlDotNet.Core.YamlException: (Line: 1, Col: 1, Idx: 0) - (Line: 1, Col: 1, Idx: 0): Exception during deserialization
 ---> System.ArgumentNullException: Value cannot be null. (Parameter 'key')
   at System.Collections.Generic.Dictionary`2.System.Collections.IDictionary.set_Item(Object key, Object value)
   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)
   --- End of inner exception stack trace ---
   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)

go-yaml-json

 error
yaml: line 2: did not find expected ',' or '}'

js-jsyaml-json

 error
/node/node_modules/js-yaml/lib/loader.js:187
  throw generateError(state, message);
  ^
YAMLException: tag suffix cannot contain flow indicator characters (2:15)

 1 | {
 2 |   foo : !!str,
-------------------^
 3 |   !!str : bar,
 4 | }
    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 readTagProperty (/node/node_modules/js-yaml/lib/loader.js:1275:7)
    at composeNode (/node/node_modules/js-yaml/lib/loader.js:1407:12)
    at readFlowCollection (/node/node_modules/js-yaml/lib/loader.js:791:7)
    at composeNode (/node/node_modules/js-yaml/lib/loader.js:1442:11)
    at readBlockMapping (/node/node_modules/js-yaml/lib/loader.js:1104:12)
    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) {
  reason: 'tag suffix cannot contain flow indicator characters',
  mark: {
    name: null,
    buffer: '{\n  foo : !!str,\n  !!str : bar,\n}\n',
    position: 16,
    line: 1,
    column: 14,
    snippet: ' 1 | {\n' +
      ' 2 |   foo : !!str,\n' +
      '-------------------^\n' +
      ' 3 |   !!str : bar,\n' +
      ' 4 | }'
  }
}

Node.js v20.13.1

perl-syck-json

 error
Syck parser (line 3, column 9): 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 9): syntax error at /perl5/lib/perl5/x86_64-linux-thread-multi/YAML/Syck.pm line 60, <> line 1.

perl-xs-json

 error
YAML::XS Error: bad tag found for scalar: 'tag:yaml.org,2002:str,' at /yaml/bin/perl-xs-json line 14, <> line 1.

perl-xs-perl

 error
YAML::XS Error: bad tag found for scalar: 'tag:yaml.org,2002:str,' at /yaml/bin/perl-xs-perl line 16, <> 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.

py-pyyaml-event

 error
+STR
+DOC
+MAP {}
=VAL :foo
=VAL <tag:yaml.org,2002:str,> :
Traceback (most recent call last):
  File "/yaml/bin/py-pyyaml-event", line 7, in <module>
    for event in yaml.parse(sys.stdin.read()):
  File "/python/lib/python3.12/site-packages/yaml/__init__.py", line 75, in parse
    while loader.check_event():
          ^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/parser.py", line 549, in parse_flow_mapping_key
    raise ParserError("while parsing a flow mapping", self.marks[-1],
yaml.parser.ParserError: while parsing a flow mapping
  in "<unicode string>", line 1, column 1:
    {
    ^
expected ',' or '}', but got '<tag>'
  in "<unicode string>", line 3, column 3:
      !!str : bar,
      ^

py-pyyaml-json

 error
Traceback (most recent call last):
  File "/yaml/bin/py-pyyaml-json", line 19, in <module>
    for doc in yaml.load_all(sys.stdin.read(), Loader=yaml.FullLoader):
  File "/python/lib/python3.12/site-packages/yaml/__init__.py", line 130, in load_all
    yield loader.get_data()
          ^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 45, in get_data
    return self.construct_document(self.get_node())
                                   ^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/composer.py", line 27, in get_node
    return self.compose_document()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/composer.py", line 127, in compose_mapping_node
    while not self.check_event(MappingEndEvent):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/parser.py", line 549, in parse_flow_mapping_key
    raise ParserError("while parsing a flow mapping", self.marks[-1],
yaml.parser.ParserError: while parsing a flow mapping
  in "<unicode string>", line 1, column 1:
    {
    ^
expected ',' or '}', but got '<tag>'
  in "<unicode string>", line 3, column 3:
      !!str : bar,
      ^

py-pyyaml-py

 error
Traceback (most recent call last):
  File "/yaml/bin/py-pyyaml-py", line 36, in <module>
    for doc in yaml.load_all(sys.stdin.read(), Loader=yaml.FullLoader):
  File "/python/lib/python3.12/site-packages/yaml/__init__.py", line 130, in load_all
    yield loader.get_data()
          ^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 45, in get_data
    return self.construct_document(self.get_node())
                                   ^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/composer.py", line 27, in get_node
    return self.compose_document()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/composer.py", line 127, in compose_mapping_node
    while not self.check_event(MappingEndEvent):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/parser.py", line 549, in parse_flow_mapping_key
    raise ParserError("while parsing a flow mapping", self.marks[-1],
yaml.parser.ParserError: while parsing a flow mapping
  in "<unicode string>", line 1, column 1:
    {
    ^
expected ',' or '}', but got '<tag>'
  in "<unicode string>", line 3, column 3:
      !!str : bar,
      ^

py-ruamel-event

 error
+STR
+DOC
+MAP {}
=VAL :foo
=VAL <tag:yaml.org,2002:str,> :
Traceback (most recent call last):
  File "/yaml/bin/py-ruamel-event", line 9, in <module>
    for event in yaml.parse(sys.stdin.read()):
  File "/python/lib/python3.12/site-packages/ruamel/yaml/main.py", line 371, in parse
    while parser.check_event():
          ^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/parser.py", line 141, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/parser.py", line 747, in parse_flow_mapping_key
    raise ParserError(
ruamel.yaml.parser.ParserError: while parsing a flow mapping
  in "<unicode string>", line 1, column 1:
    {
    ^ (line: 1)
expected ',' or '}', but got '<tag>'
  in "<unicode string>", line 3, column 3:
      !!str : bar,
      ^ (line: 3)

py-ruamel-json

 error
Traceback (most recent call last):
  File "/yaml/bin/py-ruamel-json", line 21, in <module>
    for doc in yaml.load_all(sys.stdin.read()):
  File "/python/lib/python3.12/site-packages/ruamel/yaml/main.py", line 476, in load_all
    yield constructor.get_data()
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 110, in get_data
    return self.construct_document(self.composer.get_node())
                                   ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 63, in get_node
    return self.compose_document()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 94, in compose_document
    node = self.compose_node(None, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 130, in compose_node
    node = self.compose_mapping_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 204, in compose_mapping_node
    while not self.parser.check_event(MappingEndEvent):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/parser.py", line 141, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/parser.py", line 747, in parse_flow_mapping_key
    raise ParserError(
ruamel.yaml.parser.ParserError: while parsing a flow mapping
  in "<unicode string>", line 1, column 1:
    {
    ^ (line: 1)
expected ',' or '}', but got '<tag>'
  in "<unicode string>", line 3, column 3:
      !!str : bar,
      ^ (line: 3)

py-ruamel-py

 error
Traceback (most recent call last):
  File "/yaml/bin/py-ruamel-py", line 38, in <module>
    for doc in yaml.load_all(sys.stdin.read()):
  File "/python/lib/python3.12/site-packages/ruamel/yaml/main.py", line 476, in load_all
    yield constructor.get_data()
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 110, in get_data
    return self.construct_document(self.composer.get_node())
                                   ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 63, in get_node
    return self.compose_document()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 94, in compose_document
    node = self.compose_node(None, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 130, in compose_node
    node = self.compose_mapping_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 204, in compose_mapping_node
    while not self.parser.check_event(MappingEndEvent):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/parser.py", line 141, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/parser.py", line 747, in parse_flow_mapping_key
    raise ParserError(
ruamel.yaml.parser.ParserError: while parsing a flow mapping
  in "<unicode string>", line 1, column 1:
    {
    ^ (line: 1)
expected ',' or '}', but got '<tag>'
  in "<unicode string>", line 3, column 3:
      !!str : bar,
      ^ (line: 3)

rust-yamlrust-event

 error
+STR
+DOC
+MAP
=VAL :foo
=VAL <tag:yaml.org,2002:str,> :
Error: ScanError { mark: Marker { index: 19, line: 3, col: 2 }, info: "while parsing a flow mapping, did not find expected ',' or '}'" }

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 =SYNX|{
   1    1    1    1 =EOL |\x0a
   2    0    2    2 =WSPC|..
   2    2    4    4 +PAIR|
   2    2    4    4 +NODE|
   2    2    4    4 +VAL |
   2    2    4    4 =TEXT|foo
   2    5    7    7 -VAL |
   2    5    7    7 -NODE|
   2    5    7    7 =WSPC|.
   2    6    8    8 =SYNX|:
   2    7    9    9 =WSPC|.
   2    8   10   10 +NODE|
   2    8   10   10 +PROP|
   2    8   10   10 +TAG |
   2    8   10   10 +HAND|
   2    8   10   10 =SYNX|!
   2    9   11   11 =SYNX|!
   2   10   12   12 -HAND|
   2   10   12   12 =META|str
   2   13   15   15 -TAG |
   2   13   15   15 -PROP|
   2   13   15   15 +VAL |
   2   13   15   15 -VAL |
   2   13   15   15 -NODE|
   2   13   15   15 -PAIR|
   2   13   15   15 =SYNX|,
   2   14   16   16 =EOL |\x0a
   3    0   17   17 =WSPC|..
   3    2   19   19 +PAIR|
   3    2   19   19 +NODE|
   3    2   19   19 +PROP|
   3    2   19   19 +TAG |
   3    2   19   19 +HAND|
   3    2   19   19 =SYNX|!
   3    3   20   20 =SYNX|!
   3    4   21   21 -HAND|
   3    4   21   21 =META|str
   3    7   24   24 -TAG |
   3    7   24   24 -PROP|
   3    7   24   24 +VAL |
   3    7   24   24 -VAL |
   3    7   24   24 -NODE|
   3    7   24   24 =WSPC|.
   3    8   25   25 =SYNX|:
   3    9   26   26 =WSPC|.
   3   10   27   27 +NODE|
   3   10   27   27 +VAL |
   3   10   27   27 =TEXT|bar
   3   13   30   30 -VAL |
   3   13   30   30 -NODE|
   3   13   30   30 -PAIR|
   3   13   30   30 =SYNX|,
   3   14   31   31 =EOL |\x0a
   4    0   32   32 =SYNX|}
   4    1   33   33 -MAP |
   4    1   33   33 -NODE|
   4    1   33   33 =EOL |\x0a
   5    0   34   34 -DOC |

perl-pp-perl

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

perl-pplibyaml-perl

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

perl-tiny-json

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

perl-tiny-perl

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