# YAML Test Matrix

--- &test-SYW4
  Title: Spec Example 2.2. Mapping Scalars to Scalars
  Tags: [ comment, scalar, spec ]

YAML

hr:  65    # Home runs
avg: 0.278 # Batting average
rbi: 147   # Runs Batted In

Expected Events

+STR
+DOC
+MAP
=VAL :hr
=VAL :65
=VAL :avg
=VAL :0.278
=VAL :rbi
=VAL :147
-MAP
-DOC
-STR

Expected JSON

{
"avg": 0.278,
"hr": 65,
"rbi": 147
}

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

go-yaml-json

 json_ok

hs-hsyaml-json

 json_ok

js-jsyaml-json

 json_ok

js-yaml-json

 json_ok

lua-lyaml-json

 json_ok

perl-pp-json

 json_ok

perl-pplibyaml-json

 json_ok

perl-syck-json

 json_ok

perl-xs-json

 json_ok

perl-yaml-json

 json_ok

py-pyyaml-json

 json_ok

py-ruamel-json

 json_ok

ruby-psych-json

 json_ok

dotnet-yamldotnet-json

 json_diff
{
  "avg": "0.278",
  "hr": "65",
  "rbi": "147"
}

perl-tiny-json

 json_diff
{
  "avg": "0.278",
  "hr": "65",
  "rbi": "147"
}

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 +VAL |
   1    0    0    0 =TEXT|hr
   1    2    2    2 -VAL |
   1    2    2    2 -NODE|
   1    2    2    2 =SYNX|:
   1    3    3    3 =WSPC|..
   1    5    5    5 +NODE|
   1    5    5    5 +VAL |
   1    5    5    5 =TEXT|65
   1    7    7    7 -VAL |
   1    7    7    7 -NODE|
   1    7    7    7 =WSPC|....
   1   11   11   11 +COMM|
   1   11   11   11 =SYNX|#
   1   12   12   12 =META|.Home.runs
   1   22   22   22 -COMM|
   1   22   22   22 =EOL |\x0a
   2    0   23   23 -PAIR|
   2    0   23   23 +PAIR|
   2    0   23   23 +NODE|
   2    0   23   23 +VAL |
   2    0   23   23 =TEXT|avg
   2    3   26   26 -VAL |
   2    3   26   26 -NODE|
   2    3   26   26 =SYNX|:
   2    4   27   27 =WSPC|.
   2    5   28   28 +NODE|
   2    5   28   28 +VAL |
   2    5   28   28 =TEXT|0.278
   2   10   33   33 -VAL |
   2   10   33   33 -NODE|
   2   10   33   33 =WSPC|.
   2   11   34   34 +COMM|
   2   11   34   34 =SYNX|#
   2   12   35   35 =META|.Batting.average
   2   28   51   51 -COMM|
   2   28   51   51 =EOL |\x0a
   3    0   52   52 -PAIR|
   3    0   52   52 +PAIR|
   3    0   52   52 +NODE|
   3    0   52   52 +VAL |
   3    0   52   52 =TEXT|rbi
   3    3   55   55 -VAL |
   3    3   55   55 -NODE|
   3    3   55   55 =SYNX|:
   3    4   56   56 =WSPC|.
   3    5   57   57 +NODE|
   3    5   57   57 +VAL |
   3    5   57   57 =TEXT|147
   3    8   60   60 -VAL |
   3    8   60   60 -NODE|
   3    8   60   60 =WSPC|...
   3   11   63   63 +COMM|
   3   11   63   63 =SYNX|#
   3   12   64   64 =META|.Runs.Batted.In
   3   27   79   79 -COMM|
   3   27   79   79 =EOL |\x0a
   4    0   80   80 -PAIR|
   4    0   80   80 -MAP |
   4    0   80   80 -NODE|
   4    0   80   80 -DOC |

perl-pp-perl

 na
{
  'avg' => '0.278',
  'hr' => 65,
  'rbi' => 147
}

perl-pplibyaml-perl

 na
{
  'avg' => '0.278',
  'hr' => 65,
  'rbi' => 147
}

perl-syck-perl

 na
{
  'avg' => '0.278',
  'hr' => 65,
  'rbi' => 147
}

perl-tiny-perl

 na
{
  'avg' => '0.278',
  'hr' => '65',
  'rbi' => '147'
}

perl-xs-perl

 na
{
  'avg' => '0.278',
  'hr' => 65,
  'rbi' => 147
}

perl-yaml-perl

 na
{
  'avg' => '0.278',
  'hr' => 65,
  'rbi' => 147
}

py-pyyaml-py

 na
{'avg': 0.278, 'hr': 65, 'rbi': 147}

py-ruamel-py

 na
{'avg': 0.278, 'hr': 65, 'rbi': 147}