# YAML Test Matrix

--- &test-DFF7
  Title: Spec Example 7.16. Flow Mapping Entries
  Tags: [ explicit-key, flow, mapping, spec ]

YAML

{
? explicit: entry,
implicit: entry,
?
}

Expected Events

+STR
+DOC
+MAP {}
=VAL :explicit
=VAL :entry
=VAL :implicit
=VAL :entry
=VAL :
=VAL :
-MAP
-DOC
-STR

Expected JSON



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

perl-syck-perl

 error
Syck parser (line 2, column 2): syntax error at /perl5/lib/perl5/x86_64-linux-thread-multi/YAML/Syck.pm line 60, <> line 1.

perl-yaml-perl

 error
YAML Error: Expected separator '---'
   Code: YAML_PARSE_ERR_NO_SEPARATOR
   Line: 1
   Document: 2
 at /perl5/lib/perl5/YAML/Loader.pm line 88.

c-libfyaml-json

 na
{
  "explicit": "entry",
  "implicit": "entry",
  "": null
}

dotnet-yamldotnet-json

 na
Unhandled exception. YamlDotNet.Core.YamlException: (Line: 1, Col: 1, Idx: 0) - (Line: 1, Col: 1, Idx: 0): Exception during deserialization
 ---> System.ArgumentNullException: Value cannot be null. (Parameter 'key')
   at System.Collections.Generic.Dictionary`2.System.Collections.IDictionary.set_Item(Object key, Object value)
   at YamlDotNet.Serialization.NodeDeserializers.DictionaryNodeDeserializer.DeserializeHelper(Type tKey, Type tValue, IParser parser, Func`3 nestedObjectDeserializer, IDictionary result)
   at YamlDotNet.Serialization.NodeDeserializers.DictionaryNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func`3 nestedObjectDeserializer, Object& value)
   at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
   --- End of inner exception stack trace ---
   at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
   at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
   at YamlDotNet.Serialization.Deserializer.Deserialize(IParser parser, Type type)
   at YamlDotNet.Serialization.Deserializer.Deserialize(TextReader input, Type type)
   at YamlDotNet.Serialization.Deserializer.Deserialize(TextReader input)
   at Program.Main(String[] commandLineArguments)
Aborted (core dumped)

go-yaml-json

 na
panic: interface conversion: interface {} is nil, not string

goroutine 1 [running]:
main.convert({0x4f8e60, 0xc00008c5a0})
	/buildutils/go-yaml-json.go:17 +0x1c7
main.main()
	/buildutils/go-yaml-json.go:45 +0x2a5

hs-hsyaml-json

 na
{"":null,"explicit":"entry","implicit":"entry"}

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 =SYNX|{
   1    1    1    1 =EOL |\x0a
   2    0    2    2 +PAIR|
   2    0    2    2 =SYNX|?
   2    1    3    3 =WSPC|.
   2    2    4    4 +NODE|
   2    2    4    4 +VAL |
   2    2    4    4 =TEXT|explicit
   2   10   12   12 -VAL |
   2   10   12   12 -NODE|
   2   10   12   12 =SYNX|:
   2   11   13   13 =WSPC|.
   2   12   14   14 +NODE|
   2   12   14   14 +VAL |
   2   12   14   14 =TEXT|entry
   2   17   19   19 -VAL |
   2   17   19   19 -NODE|
   2   17   19   19 -PAIR|
   2   17   19   19 =SYNX|,
   2   18   20   20 =EOL |\x0a
   3    0   21   21 +PAIR|
   3    0   21   21 +NODE|
   3    0   21   21 +VAL |
   3    0   21   21 =TEXT|implicit
   3    8   29   29 -VAL |
   3    8   29   29 -NODE|
   3    8   29   29 =SYNX|:
   3    9   30   30 =WSPC|.
   3   10   31   31 +NODE|
   3   10   31   31 +VAL |
   3   10   31   31 =TEXT|entry
   3   15   36   36 -VAL |
   3   15   36   36 -NODE|
   3   15   36   36 -PAIR|
   3   15   36   36 =SYNX|,
   3   16   37   37 =EOL |\x0a
   4    0   38   38 +PAIR|
   4    0   38   38 =SYNX|?
   4    1   39   39 =EOL |\x0a
   5    0   40   40 +NODE|
   5    0   40   40 +VAL |
   5    0   40   40 -VAL |
   5    0   40   40 -NODE|
   5    0   40   40 +NODE|
   5    0   40   40 +VAL |
   5    0   40   40 -VAL |
   5    0   40   40 -NODE|
   5    0   40   40 -PAIR|
   5    0   40   40 =SYNX|}
   5    1   41   41 -MAP |
   5    1   41   41 -NODE|
   5    1   41   41 =EOL |\x0a
   6    0   42   42 -DOC |

js-jsyaml-json

 na
{"explicit":"entry","implicit":"entry","null":null}

js-yaml-json

 na
{
  "explicit": "entry",
  "implicit": "entry",
  "": null
}

lua-lyaml-json

 na
luajit: /yaml/bin/lua-lyaml-json:8: Cannot serialise table: table key must be a number or string
stack traceback:
	[C]: in function 'encode'
	/yaml/bin/lua-lyaml-json:8: in main chunk
	[C]: at 0x555d66658ed0

perl-pp-json

 na
{
   "" : null,
   "explicit" : "entry",
   "implicit" : "entry"
}

perl-pp-perl

 na
{
  '' => undef,
  'explicit' => 'entry',
  'implicit' => 'entry'
}

perl-pplibyaml-json

 na
{
   "" : null,
   "explicit" : "entry",
   "implicit" : "entry"
}

perl-pplibyaml-perl

 na
{
  '' => undef,
  'explicit' => 'entry',
  'implicit' => 'entry'
}

perl-syck-json

 na
Syck parser (line 2, column 2): syntax error at /perl5/lib/perl5/x86_64-linux-thread-multi/YAML/Syck.pm line 60, <> line 1.

perl-tiny-json

 na
YAML::Tiny failed to classify line '{' at /yaml/bin/perl-tiny-json line 12.

perl-xs-json

 na
{
   "" : null,
   "explicit" : "entry",
   "implicit" : "entry"
}
Use of uninitialized value in subroutine entry at /yaml/bin/perl-xs-json line 14, <> line 1.

perl-xs-perl

 na
{
  '' => undef,
  'explicit' => 'entry',
  'implicit' => 'entry'
}
Use of uninitialized value in subroutine entry at /yaml/bin/perl-xs-perl line 16, <> line 1.

perl-yaml-json

 na
YAML Error: Expected separator '---'
   Code: YAML_PARSE_ERR_NO_SEPARATOR
   Line: 1
   Document: 2
 at /perl5/lib/perl5/YAML/Loader.pm line 88.

py-pyyaml-json

 na
Error json.dumps: <class 'TypeError'>
Traceback (most recent call last):
  File "/yaml/bin/py-pyyaml-json", line 21, in <module>
    print(json.dumps(doc, sort_keys=True, skipkeys=True, indent=2))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
          ^^^^^^^^^^^
  File "/usr/lib/python3.12/json/encoder.py", line 202, in encode
    chunks = list(chunks)
             ^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/encoder.py", line 432, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "/usr/lib/python3.12/json/encoder.py", line 354, in _iterencode_dict
    items = sorted(dct.items())
            ^^^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'NoneType' and 'str'

py-pyyaml-py

 na
{None: None, 'explicit': 'entry', 'implicit': 'entry'}

py-ruamel-json

 na
Error json.dumps: <class 'TypeError'>
Traceback (most recent call last):
  File "/yaml/bin/py-ruamel-json", line 23, in <module>
    print(json.dumps(doc, sort_keys=True, skipkeys=True, indent=2))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
          ^^^^^^^^^^^
  File "/usr/lib/python3.12/json/encoder.py", line 202, in encode
    chunks = list(chunks)
             ^^^^^^^^^^^^
  File "/usr/lib/python3.12/json/encoder.py", line 432, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "/usr/lib/python3.12/json/encoder.py", line 354, in _iterencode_dict
    items = sorted(dct.items())
            ^^^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'NoneType' and 'str'

py-ruamel-py

 na
{None: None, 'explicit': 'entry', 'implicit': 'entry'}

ruby-psych-json

 na
{"explicit":"entry","implicit":"entry","":null}

perl-tiny-perl

 ni
YAML::Tiny failed to classify line '{' at /yaml/bin/perl-tiny-perl line 15.