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

dotnet-yamldotnet-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

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.

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|a!"#$%&'()*+,-./09:;<=>?@AZ[\x5c]^_`az{|}~
   1   39   39   39 -VAL |
   1   39   39   39 -NODE|
   1   39   39   39 =SYNX|:
   1   40   40   40 =WSPC|.
   1   41   41   41 +NODE|
   1   41   41   41 +VAL |
   1   41   41   41 =TEXT|safe
   1   45   45   45 -VAL |
   1   45   45   45 -NODE|
   1   45   45   45 =EOL |\x0a
   2    0   46   46 -PAIR|
   2    0   46   46 +PAIR|
   2    0   46   46 =SYNX|?
   2    1   47   47 +NODE|
   2    1   47   47 +VAL |
   2    1   47   47 -VAL |
   2    1   47   47 -NODE|
   2    1   47   47 =REST|foo:.safe.question.mark
   2   24   70   70 =REST|\x0a
   3    0   71   71 =SYNX|:
   3    1   72   72 +NODE|
   3    1   72   72 +VAL |
   3    1   72   72 -VAL |
   3    1   72   72 -NODE|
   3    1   72   72 =REST|foo:.safe.colon
   3   16   87   87 =REST|\x0a
   4    0   88   88 -PAIR|
   4    0   88   88 +PAIR|
   4    0   88   88 +NODE|
   4    0   88   88 +VAL |
   4    0   88   88 =TEXT|-foo
   4    4   92   92 -VAL |
   4    4   92   92 -NODE|
   4    4   92   92 =SYNX|:
   4    5   93   93 =WSPC|.
   4    6   94   94 +NODE|
   4    6   94   94 +VAL |
   4    6   94   94 =TEXT|safe.dash
   4   15  103  103 -VAL |
   4   15  103  103 -NODE|
   4   15  103  103 =EOL |\x0a
   5    0  104  104 -PAIR|
   5    0  104  104 +PAIR|
   5    0  104  104 +NODE|
   5    0  104  104 +VAL |
   5    0  104  104 =TEXT|this.is#not
   5   11  115  115 -VAL |
   5   11  115  115 -NODE|
   5   11  115  115 =SYNX|:
   5   12  116  116 =WSPC|.
   5   13  117  117 +NODE|
   5   13  117  117 +VAL |
   5   13  117  117 =TEXT|a.comment
   5   22  126  126 -VAL |
   5   22  126  126 -NODE|
   5   22  126  126 =EOL |\x0a
   6    0  127  127 -PAIR|
   6    0  127  127 -MAP |
   6    0  127  127 -NODE|
   6    0  127  127 -DOC |

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