# YAML Test Matrix

--- &test-J7PZ
  Title: Spec Example 2.26. Ordered Mappings
  Tags: [ mapping, spec ]

YAML

# Ordered maps are represented as
# A sequence of mappings, with
# each mapping having one key
--- !!omap
- Mark McGwire: 65
- Sammy Sosa: 63
- Ken Griffy: 58

Expected Events

+STR
+DOC ---
+SEQ <tag:yaml.org,2002:omap>
+MAP
=VAL :Mark McGwire
=VAL :65
-MAP
+MAP
=VAL :Sammy Sosa
=VAL :63
-MAP
+MAP
=VAL :Ken Griffy
=VAL :58
-MAP
-SEQ
-DOC
-STR

Expected JSON

[
{
"Mark McGwire": 65
},
{
"Sammy Sosa": 63
},
{
"Ken Griffy": 58
}
]

cpp-event

 ok

hs-yaml-event

 ok

java-event

 ok

js-event

 ok

libyaml-event

 ok

nimyaml-event

 ok

perl5-pp-event

 ok

pyyaml-event

 ok

ruamel-event

 ok

hs-yaml-json

 json_ok

js-json

 json_ok

js-yaml-json

 json_ok

luajit-json

 json_ok

perl5-pm-json

 json_ok

perl5-pp-json

 json_ok

perl5-pegex-event

 diff
Got Events:
+STR
+DOC ---
+MAP <tag:yaml.org,2002:omap>
=VAL :- Mark McGwire
=VAL :65
-MAP
-DOC
+DOC
+SEQ
=VAL :Sammy Sosa
-SEQ
-DOC
+DOC
+MAP
=VAL :
=VAL :63
=VAL :- Ken Griffy
=VAL :58
-MAP
-DOC
-STR

java-json

 json_diff
{
  "Ken Griffy": 58,
  "Mark McGwire": 65,
  "Sammy Sosa": 63
}

perl5-syck-json

 json_diff
null

pyyaml-json

 json_diff
[
  [
    "Mark McGwire",
    65
  ],
  [
    "Sammy Sosa",
    63
  ],
  [
    "Ken Griffy",
    58
  ]
]

ruamel-json

 json_diff
{
  "Ken Griffy": 58,
  "Mark McGwire": 65,
  "Sammy Sosa": 63
}

ruby-json

 json_diff
{
  "Ken Griffy": 58,
  "Mark McGwire": 65,
  "Sammy Sosa": 63
}

perl5-tiny-json

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

perl5-tiny-pl

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

perl5-xs-json

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

    bad tag found for array: 'tag:yaml.org,2002:omap'

was found at document: 1

perl5-xs-pl

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

    bad tag found for array: 'tag:yaml.org,2002:omap'

was found at document: 1

perl5-pm-pl

 na
[
  {
    'Mark McGwire' => 65
  },
  {
    'Sammy Sosa' => 63
  },
  {
    'Ken Griffy' => 58
  }
]

perl5-pp-pl

 na
[
  {
    'Mark McGwire' => 65
  },
  {
    'Sammy Sosa' => 63
  },
  {
    'Ken Griffy' => 58
  }
]

perl5-syck-pl

 na
bless( [
         {
           'Mark McGwire' => 65
         },
         {
           'Sammy Sosa' => 63
         },
         {
           'Ken Griffy' => 58
         }
       ], 'omap' )

pyyaml-py

 na
[('Mark McGwire', 65), ('Sammy Sosa', 63), ('Ken Griffy', 58)]

ruamel-py

 na
ordereddict([('Mark McGwire', 65), ('Sammy Sosa', 63), ('Ken Griffy', 58)])