# YAML Test Matrix

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

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



cpp-event

 ok

hs-yaml-event

 ok

java-event

 ok

libyaml-event

 ok

nimyaml-event

 ok

perl5-pp-event

 ok

pyyaml-event

 ok

ruamel-event

 ok

perl5-pegex-event

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

perl5-pm-json

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

perl5-pm-pl

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

perl5-syck-json

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

perl5-tiny-json

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

perl5-tiny-pl

 error
YAML::Tiny does not support a feature in line '!!set' at /bin/perl5-tiny-pl line 15.

perl5-xs-json

 error
YAML::XS::Load Error: The problem:

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

was found at document: 1

perl5-xs-pl

 error
YAML::XS::Load Error: The problem:

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

was found at document: 1

pyyaml-json

 error
Error json.dumps: <type 'exceptions.TypeError'>
Traceback (most recent call last):
  File "/bin/pyyaml-json", line 21, in <module>
    print json.dumps(doc, sort_keys=True, skipkeys=True, indent=2)
  File "/usr/lib/python2.7/json/__init__.py", line 251, in dumps
    sort_keys=sort_keys, **kw).encode(obj)
  File "/usr/lib/python2.7/json/encoder.py", line 209, in encode
    chunks = list(chunks)
  File "/usr/lib/python2.7/json/encoder.py", line 442, in _iterencode
    o = _default(o)
  File "/usr/lib/python2.7/json/encoder.py", line 184, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: set(['Ken Griff', 'Sammy Sosa', 'Mark McGwire']) is not JSON serializable

ruamel-json

 error
Error json.dumps: <type 'exceptions.TypeError'>
Traceback (most recent call last):
  File "/bin/ruamel-json", line 21, in <module>
    print json.dumps(doc, sort_keys=True, skipkeys=True, indent=2)
  File "/usr/lib/python2.7/json/__init__.py", line 251, in dumps
    sort_keys=sort_keys, **kw).encode(obj)
  File "/usr/lib/python2.7/json/encoder.py", line 209, in encode
    chunks = list(chunks)
  File "/usr/lib/python2.7/json/encoder.py", line 442, in _iterencode
    o = _default(o)
  File "/usr/lib/python2.7/json/encoder.py", line 184, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: set(['Ken Griff', 'Sammy Sosa', 'Mark McGwire']) is not JSON serializable

hs-yaml-json

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

java-json

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

js-yaml-json

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

luajit-json

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

perl5-pp-json

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

perl5-pp-pl

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

pyyaml-py

 na
set(['Ken Griff', 'Mark McGwire', 'Sammy Sosa'])

ruamel-py

 na
set(['Ken Griff', 'Mark McGwire', 'Sammy Sosa'])

ruby-json

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