# YAML Test Matrix

--- &test-7Z25
  Title: Bare document after document end marker
  Tags: [ footer ]

YAML

---
scalar1
...
key: value

Expected Events

+STR
+DOC ---
=VAL :scalar1
-DOC ...
+DOC
+MAP
=VAL :key
=VAL :value
-MAP
-DOC
-STR

Expected JSON

"scalar1"
{
"key": "value"
}

c-libfyaml-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-ruamel-event

 ok

c-libfyaml-json

 json_ok

hs-hsyaml-json

 json_ok

js-jsyaml-json

 json_ok

js-yaml-json

 json_ok

perl-pp-json

 json_ok

py-ruamel-json

 json_ok

cpp-rapidyaml-event

 diff
Minimal Events:
+STR
+DOC ---
=VAL :scalar1
-DOC ...
+DOC
+MAP
=VAL :key
=VAL :value
-MAP
-DOC
-STR
Transformed Events:
+STR
+DOC ---
=VAL :scalar1
-DOC
+DOC ---
+MAP
=VAL :key
=VAL :value
-MAP
-DOC
-STR
Got Events:
+STR
+DOC ---
=VAL :scalar1
-DOC
+DOC ---
+MAP
=VAL :key
=VAL :value
-MAP
-DOC
-STR

perl-syck-json

 json_diff
{
  "scalar1 ... key": "value"
}

c-libyaml-event

 error
+STR
+DOC ---
=VAL :scalar1
-DOC ...
Parse error: did not find expected <document start>

dotnet-yamldotnet-json

 error
Unhandled exception. YamlDotNet.Core.YamlException: (Line: 4, Col: 1, Idx: 16) - (Line: 4, Col: 1, Idx: 16): Expected 'StreamEnd', got 'DocumentStart' (at Line: 4, Col: 1, Idx: 16).
   at YamlDotNet.Core.ParserExtensions.Require[T](IParser parser)
   at YamlDotNet.Core.ParserExtensions.Consume[T](IParser parser)
   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

 error
"scalar1"
yaml: line 3: did not find expected <document start>

lua-lyaml-json

 error
luajit: 3:1: did not find expected <document start>
stack traceback:
	[C]: in function 'error'
	/usr/local/share/lua/5.1/lyaml/init.lua:306: in function 'error'
	/usr/local/share/lua/5.1/lyaml/init.lua:325: in function 'parse'
	/usr/local/share/lua/5.1/lyaml/init.lua:496: in function 'load'
	/yaml/bin/lua-lyaml-json:6: in main chunk
	[C]: at 0x55a854211ed0

perl-pplibyaml-json

 error
YAML::PP::LibYAML Error: The problem:

    did not find expected <document start>

was found at , line: 4, column: 1

perl-pplibyaml-perl

 error
YAML::PP::LibYAML Error: The problem:

    did not find expected <document start>

was found at , line: 4, column: 1

perl-tiny-json

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

perl-tiny-perl

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

perl-xs-json

 error
YAML::XS::Load Error: The problem:

    did not find expected <document start>

was found at document: 2, line: 4, column: 1

perl-xs-perl

 error
YAML::XS::Load Error: The problem:

    did not find expected <document start>

was found at document: 2, line: 4, column: 1

perl-yaml-json

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

perl-yaml-perl

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

py-pyyaml-event

 error
+STR
+DOC ---
=VAL :scalar1
-DOC ...
Traceback (most recent call last):
  File "/yaml/bin/py-pyyaml-event", line 7, in <module>
    for event in yaml.parse(sys.stdin.read()):
  File "/python/lib/python3.12/site-packages/yaml/__init__.py", line 75, in parse
    while loader.check_event():
          ^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/parser.py", line 171, in parse_document_start
    raise ParserError(None, None,
yaml.parser.ParserError: expected '<document start>', but found '<block mapping start>'
  in "<unicode string>", line 4, column 1:
    key: value
    ^

py-pyyaml-json

 error
"scalar1"
Traceback (most recent call last):
  File "/yaml/bin/py-pyyaml-json", line 19, in <module>
    for doc in yaml.load_all(sys.stdin.read(), Loader=yaml.FullLoader):
  File "/python/lib/python3.12/site-packages/yaml/__init__.py", line 129, in load_all
    while loader.check_data():
          ^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 32, in check_data
    return self.check_node()
           ^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/composer.py", line 18, in check_node
    if self.check_event(StreamStartEvent):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/parser.py", line 171, in parse_document_start
    raise ParserError(None, None,
yaml.parser.ParserError: expected '<document start>', but found '<block mapping start>'
  in "<unicode string>", line 4, column 1:
    key: value
    ^

py-pyyaml-py

 error
'scalar1'
Traceback (most recent call last):
  File "/yaml/bin/py-pyyaml-py", line 36, in <module>
    for doc in yaml.load_all(sys.stdin.read(), Loader=yaml.FullLoader):
  File "/python/lib/python3.12/site-packages/yaml/__init__.py", line 129, in load_all
    while loader.check_data():
          ^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 32, in check_data
    return self.check_node()
           ^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/composer.py", line 18, in check_node
    if self.check_event(StreamStartEvent):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/yaml/parser.py", line 171, in parse_document_start
    raise ParserError(None, None,
yaml.parser.ParserError: expected '<document start>', but found '<block mapping start>'
  in "<unicode string>", line 4, column 1:
    key: value
    ^

ruby-psych-json

 error
/ruby/gems/psych/lib/psych.rb:458:in `parse': (<unknown>): did not find expected <document start> at line 1 column 1 (Psych::SyntaxError)
	from /ruby/gems/psych/lib/psych.rb:458:in `parse_stream'
	from /ruby/gems/psych/lib/psych.rb:632:in `load_stream'
	from /yaml/bin/ruby-psych-json:6:in `<main>'

rust-yamlrust-event

 error
+STR
+DOC
=VAL :scalar1
-DOC
Error: ScanError { mark: Marker { index: 19, line: 4, col: 3 }, info: "did not find expected <document start>" }

hs-reference-yeast

 na
Line  Col Char Byte Token|Content
   1    0    0    0 +DOC |
   1    0    0    0 =HEAD|---
   1    3    3    3 =EOL |\x0a
   2    0    4    4 +NODE|
   2    0    4    4 +VAL |
   2    0    4    4 =TEXT|scalar1
   2    7   11   11 -VAL |
   2    7   11   11 -NODE|
   2    7   11   11 =EOL |\x0a
   3    0   12   12 -DOC |
   3    0   12   12 =FOOT|...
   3    3   15   15 =EOL |\x0a
   4    0   16   16 +DOC |
   4    0   16   16 +NODE|
   4    0   16   16 +MAP |
   4    0   16   16 +PAIR|
   4    0   16   16 +NODE|
   4    0   16   16 +VAL |
   4    0   16   16 =TEXT|key
   4    3   19   19 -VAL |
   4    3   19   19 -NODE|
   4    3   19   19 =SYNX|:
   4    4   20   20 =WSPC|.
   4    5   21   21 +NODE|
   4    5   21   21 +VAL |
   4    5   21   21 =TEXT|value
   4   10   26   26 -VAL |
   4   10   26   26 -NODE|
   4   10   26   26 =EOL |\x0a
   5    0   27   27 -PAIR|
   5    0   27   27 -MAP |
   5    0   27   27 -NODE|
   5    0   27   27 -DOC |

perl-pp-perl

 na
'scalar1'
{
  'key' => 'value'
}

perl-syck-perl

 na
{
  'scalar1 ... key' => 'value'
}

py-ruamel-py

 na
'scalar1'
{'key': 'value'}