YAML Test Matrix

Test #2EBW - Allowed characters in keys

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

java-json

 json_ok

js-yaml-json

 json_ok

libyaml-event

 ok

luajit-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

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 350.

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 350.

perl5-pp-event

 ok

perl5-pp-json

 json_ok

perl5-pp-pl

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

perl5-syck-json

 json_ok

perl5-syck-pl

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

perl5-tiny-json

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

perl5-tiny-pl

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

perl5-xs-json

 json_ok

perl5-xs-pl

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

pyyaml-event

 ok

pyyaml-json

 json_ok

pyyaml-py

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

ruamel-event

 ok

ruamel-json

 json_ok

ruamel-py

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

ruby-json

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