# YAML Test Matrix

--- &test-2XXW
  Title: Spec Example 2.25. Unordered Sets
  Tags: [ explicit-key, mapping, spec, unknown-tag ]

YAML

# Sets are represented as a
# Mapping where each key is
# associated with a null value
--- !!set
? Mark McGwire
? Sammy Sosa
? Ken Griff

Expected Events

+STR
+DOC ---
+MAP <tag:yaml.org,2002:set>
=VAL :Mark McGwire
=VAL :
=VAL :Sammy Sosa
=VAL :
=VAL :Ken Griff
=VAL :
-MAP
-DOC
-STR

Expected JSON

{
"Ken Griff": null,
"Mark McGwire": null,
"Sammy Sosa": null
}

c-libfyaml-event

 ok

c-libyaml-event

 ok

cpp-rapidyaml-event

 ok

cpp-yamlcpp-event

 ok

dotnet-yamldotnet-event

 ok

hs-hsyaml-event

 ok

java-snakeengine-event

 ok

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

c-libfyaml-json

 json_ok

go-yaml-json

 json_ok

hs-hsyaml-json

 json_ok

js-jsyaml-json

 json_ok

perl-pp-json

 json_ok

perl-pplibyaml-json

 json_ok

ruby-psych-json

 json_ok

rust-yamlrust-event

 diff
Minimal Events:
+STR
+DOC
+MAP <tag:yaml.org,2002:set>
=VAL :Mark McGwire
=VAL :
=VAL :Sammy Sosa
=VAL :
=VAL :Ken Griff
=VAL :
-MAP
-DOC
-STR
Transformed Events:
+STR
+DOC
+MAP
=VAL :Mark McGwire
=VAL :
=VAL :Sammy Sosa
=VAL :
=VAL :Ken Griff
=VAL :
-MAP
-DOC
-STR
Got Events:
+STR
+DOC
+MAP
=VAL :Mark McGwire
=VAL :
=VAL :Sammy Sosa
=VAL :
=VAL :Ken Griff
=VAL :
-MAP
-DOC
-STR

java-snakeengine-json

 json_diff
[
  "Mark McGwire",
  "Sammy Sosa",
  "Ken Griff"
]

java-snakeyaml-json

 json_diff
[
  "Mark McGwire",
  "Sammy Sosa",
  "Ken Griff"
]

js-yaml-json

 json_diff
{}

lua-lyaml-json

 json_diff
{
  "Ken Griff": {},
  "Mark McGwire": {},
  "Sammy Sosa": {}
}

perl-syck-json

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

perl-yaml-json

 error
YAML Error: Invalid element in map
   Code: YAML_LOAD_ERR_BAD_MAP_ELEMENT
   Line: 6
   Document: 1
 at /perl5/lib/perl5/YAML/Loader.pm line 360.

perl-yaml-perl

 error
YAML Error: Invalid element in map
   Code: YAML_LOAD_ERR_BAD_MAP_ELEMENT
   Line: 6
   Document: 1
 at /perl5/lib/perl5/YAML/Loader.pm line 360.

py-pyyaml-json

 error
Error json.dumps: <class 'TypeError'>
Traceback (most recent call last):
  File "/yaml/bin/py-pyyaml-json", line 21, in <module>
    print(json.dumps(doc, sort_keys=True, skipkeys=True, indent=2))
  File "/usr/lib/python3.7/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "/usr/lib/python3.7/json/encoder.py", line 201, in encode
    chunks = list(chunks)
  File "/usr/lib/python3.7/json/encoder.py", line 438, in _iterencode
    o = _default(o)
  File "/usr/lib/python3.7/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type set is not JSON serializable

py-ruamel-json

 error
Error json.dumps: <class 'TypeError'>
Traceback (most recent call last):
  File "/yaml/bin/py-ruamel-json", line 21, in <module>
    print(json.dumps(doc, sort_keys=True, skipkeys=True, indent=2))
  File "/usr/lib/python3.7/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "/usr/lib/python3.7/json/encoder.py", line 201, in encode
    chunks = list(chunks)
  File "/usr/lib/python3.7/json/encoder.py", line 438, in _iterencode
    o = _default(o)
  File "/usr/lib/python3.7/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type set is not JSON serializable

raku-yamlish-json

 error
Couldn't parse YAML
  in sub load-yamls at /raku/sources/44795C7AB0F35700F4CA9C3E2CC5C924EE4C608F (YAMLish) line 959
  in block <unit> at /yaml/bin/raku-yamlish-json line 6

raku-yamlish-raku

 error
Couldn't parse YAML
  in sub load-yamls at /raku/sources/44795C7AB0F35700F4CA9C3E2CC5C924EE4C608F (YAMLish) line 959
  in block <unit> at /yaml/bin/raku-yamlish-raku line 6

hs-reference-yeast

 na
Line  Col Char Byte Token|Content
   1    0    0    0 +COMM|
   1    0    0    0 =SYNX|#
   1    1    1    1 =META|.Sets.are.represented.as.a
   1   27   27   27 -COMM|
   1   27   27   27 =EOL |\x0a
   2    0   28   28 +COMM|
   2    0   28   28 =SYNX|#
   2    1   29   29 =META|.Mapping.where.each.key.is
   2   27   55   55 -COMM|
   2   27   55   55 =EOL |\x0a
   3    0   56   56 +COMM|
   3    0   56   56 =SYNX|#
   3    1   57   57 =META|.associated.with.a.null.value
   3   30   86   86 -COMM|
   3   30   86   86 =EOL |\x0a
   4    0   87   87 +DOC |
   4    0   87   87 =HEAD|---
   4    3   90   90 +NODE|
   4    3   90   90 =WSPC|.
   4    4   91   91 +PROP|
   4    4   91   91 +TAG |
   4    4   91   91 +HAND|
   4    4   91   91 =SYNX|!
   4    5   92   92 =SYNX|!
   4    6   93   93 -HAND|
   4    6   93   93 =META|set
   4    9   96   96 -TAG |
   4    9   96   96 -PROP|
   4    9   96   96 =EOL |\x0a
   5    0   97   97 +MAP |
   5    0   97   97 +PAIR|
   5    0   97   97 =SYNX|?
   5    1   98   98 =WSPC|.
   5    2   99   99 +NODE|
   5    2   99   99 +VAL |
   5    2   99   99 =TEXT|Mark.McGwire
   5   14  111  111 -VAL |
   5   14  111  111 -NODE|
   5   14  111  111 =EOL |\x0a
   6    0  112  112 +NODE|
   6    0  112  112 +VAL |
   6    0  112  112 -VAL |
   6    0  112  112 -NODE|
   6    0  112  112 -PAIR|
   6    0  112  112 +PAIR|
   6    0  112  112 =SYNX|?
   6    1  113  113 =WSPC|.
   6    2  114  114 +NODE|
   6    2  114  114 +VAL |
   6    2  114  114 =TEXT|Sammy.Sosa
   6   12  124  124 -VAL |
   6   12  124  124 -NODE|
   6   12  124  124 =EOL |\x0a
   7    0  125  125 +NODE|
   7    0  125  125 +VAL |
   7    0  125  125 -VAL |
   7    0  125  125 -NODE|
   7    0  125  125 -PAIR|
   7    0  125  125 +PAIR|
   7    0  125  125 =SYNX|?
   7    1  126  126 =WSPC|.
   7    2  127  127 +NODE|
   7    2  127  127 +VAL |
   7    2  127  127 =TEXT|Ken.Griff
   7   11  136  136 -VAL |
   7   11  136  136 -NODE|
   7   11  136  136 =EOL |\x0a
   8    0  137  137 +NODE|
   8    0  137  137 +VAL |
   8    0  137  137 -VAL |
   8    0  137  137 -NODE|
   8    0  137  137 -PAIR|
   8    0  137  137 -MAP |
   8    0  137  137 -NODE|
   8    0  137  137 -DOC |

perl-pp-perl

 na
{
  'Ken Griff' => undef,
  'Mark McGwire' => undef,
  'Sammy Sosa' => undef
}

perl-pplibyaml-perl

 na
{
  'Ken Griff' => undef,
  'Mark McGwire' => undef,
  'Sammy Sosa' => undef
}

py-pyyaml-py

 na
{'Ken Griff', 'Mark McGwire', 'Sammy Sosa'}

py-ruamel-py

 na
{'Mark McGwire', 'Sammy Sosa', 'Ken Griff'}

dotnet-yamldotnet-json

 ni
Unhandled exception. YamlDotNet.Core.YamlException: (Line: 4, Col: 5, Idx: 91) - (Line: 5, Col: 1, Idx: 97): Encountered an unresolved tag 'tag:yaml.org,2002:set'
   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.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)

perl-tiny-json

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

perl-tiny-perl

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

perl-xs-json

 ni
YAML::XS::Load Error: The problem:

    bad tag found for hash: 'tag:yaml.org,2002:set'

was found at document: 1

perl-xs-perl

 ni
YAML::XS::Load Error: The problem:

    bad tag found for hash: 'tag:yaml.org,2002:set'

was found at document: 1