# YAML Test Matrix

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

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"
}

cpp-event

 ok

java-event

 ok

libyaml-event

 ok

perl5-pp-event

 ok

pyyaml-event

 ok

ruamel-event

 ok

java-json

 json_ok

js-yaml-json

 json_ok

luajit-json

 json_ok

perl5-pp-json

 json_ok

perl5-syck-json

 json_ok

perl5-xs-json

 json_ok

pyyaml-json

 json_ok

ruamel-json

 json_ok

nimyaml-event

 diff
Got 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

perl5-pegex-event

 diff
Got 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

ruby-json

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

hs-yaml-event

 error
+STR
+DOC
+MAP
=VAL :a!"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~
=VAL :safe
=VAL :
parsing error near byte offset 47

perl5-pm-json

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

perl5-pm-pl

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

perl5-tiny-json

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

perl5-tiny-pl

 error
YAML::Tiny failed to classify line ':foo: safe colon' at /bin/perl5-tiny-pl line 14.

perl5-pp-pl

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

perl5-syck-pl

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

perl5-xs-pl

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

pyyaml-py

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

ruamel-py

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