# YAML Test Matrix

--- &test-2EBW
  Title: Allowed characters in keys
  Tags: [ mapping, scalar ]

YAML

a!"#$%&'()*+,-./09:;<=>?@AZ[\]^_`az{|}~: safe
?foo: safe question mark
:foo: safe colon
-foo: safe dash
this is#not: a comment

Expected Events

+STR
+DOC
+MAP
=VAL :a!"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~
=VAL :safe
=VAL :?foo
=VAL :safe question mark
=VAL ::foo
=VAL :safe colon
=VAL :-foo
=VAL :safe dash
=VAL :this is#not
=VAL :a comment
-MAP
-DOC
-STR

Expected JSON

{
"-foo": "safe dash",
":foo": "safe colon",
"?foo": "safe question mark",
"a!\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~": "safe",
"this is#not": "a comment"
}

c-libfyaml-event

 ok

c-libyaml-event

 ok

cpp-yamlcpp-event

 ok

dotnet-yamldotnet-event

 ok

hs-hsyaml-event

 ok

java-snakeyaml-event

 ok

js-yaml-event

 ok

nim-nimyaml-event

 ok

perl-pp-event

 ok

perl-pplibyaml-event

 ok

perl-refparser-event

 ok

py-pyyaml-event

 ok

py-ruamel-event

 ok

c-libfyaml-json

 json_ok

dotnet-yamldotnet-json

 json_ok

hs-hsyaml-json

 json_ok

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

py-pyyaml-json

 json_ok

py-ruamel-json

 json_ok

ruby-psych-json

 json_diff
{
  "-foo": "safe dash",
  "?foo": "safe question mark",
  "a!\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~": "safe",
  "foo": "safe colon",
  "this is#not": "a comment"
}

perl-tiny-json

 error
YAML::Tiny failed to classify line ':foo: safe colon' at /yaml/bin/perl-tiny-json line 12.

perl-tiny-perl

 error
YAML::Tiny failed to classify line ':foo: safe colon' at /yaml/bin/perl-tiny-perl line 15.

perl-yaml-json

 error
YAML Error: Invalid element in map
   Code: YAML_LOAD_ERR_BAD_MAP_ELEMENT
   Line: 1
   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: 1
   Document: 1
 at /perl5/lib/perl5/YAML/Loader.pm line 360.

perl-pp-perl

 na
{
  '-foo' => 'safe dash',
  ':foo' => 'safe colon',
  '?foo' => 'safe question mark',
  'a!"#$%&\'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~' => 'safe',
  'this is#not' => 'a comment'
}

perl-pplibyaml-perl

 na
{
  '-foo' => 'safe dash',
  ':foo' => 'safe colon',
  '?foo' => 'safe question mark',
  'a!"#$%&\'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~' => 'safe',
  'this is#not' => 'a comment'
}

perl-syck-perl

 na
{
  '-foo' => 'safe dash',
  ':foo' => 'safe colon',
  '?foo' => 'safe question mark',
  'a!"#$%&\'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~' => 'safe',
  'this is#not' => 'a comment'
}

perl-xs-perl

 na
{
  '-foo' => 'safe dash',
  ':foo' => 'safe colon',
  '?foo' => 'safe question mark',
  'a!"#$%&\'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~' => 'safe',
  'this is#not' => 'a comment'
}

py-pyyaml-py

 na
{'-foo': 'safe dash',
 ':foo': 'safe colon',
 '?foo': 'safe question mark',
 'a!"#$%&\'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~': 'safe',
 'this is#not': 'a comment'}

py-ruamel-py

 na
{'-foo': 'safe dash',
 ':foo': 'safe colon',
 '?foo': 'safe question mark',
 'a!"#$%&\'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~': 'safe',
 'this is#not': 'a comment'}