# YAML Test Matrix

--- &test-M7A3
  Title: Spec Example 9.3. Bare Documents
  Tags: [ 1.3-err, footer, spec ]

YAML

Bare
document
...
# No document
...
|
%!PS-Adobe-2.0 # Not the first line

Expected Events

+STR
+DOC
=VAL :Bare document
-DOC ...
+DOC
=VAL |%!PS-Adobe-2.0 # Not the first line\n
-DOC
-STR

Expected JSON

"Bare document"
"%!PS-Adobe-2.0 # Not the first line\n"

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

c-libfyaml-json

 json_ok

hs-hsyaml-json

 json_ok

perl-pp-json

 json_ok

cpp-rapidyaml-event

 diff
Minimal Events:
+STR
+DOC
=VAL :Bare document
-DOC ...
+DOC
=VAL :%!PS-Adobe-2.0 # Not the first line\n
-DOC
-STR
Transformed Events:
+STR
+DOC ---
=VAL :Bare document
-DOC
+DOC ---
=VAL :%!PS-Adobe-2.0 # Not the first line\n
-DOC
-STR
Got Events:
+STR
+DOC ---
=VAL :Bare document
-DOC
+DOC ---
=VAL '%!PS-Adobe-2.0 # Not the first line\n
-DOC
-STR

cpp-yamlcpp-event

 diff
Minimal Events:
+STR
+DOC
=VAL :Bare document
-DOC
+DOC
=VAL :%!PS-Adobe-2.0 # Not the first line\n
-DOC
-STR
Transformed Events:
+STR
+DOC
=VAL :Bare document
-DOC
+DOC
=VAL :
-DOC
-STR
Got Events:
+STR
+DOC
=VAL :Bare document
-DOC
+DOC
=VAL :
-DOC
-STR

js-jsyaml-json

 json_diff
"Bare document"
null
"%!PS-Adobe-2.0 # Not the first line\n"

js-yaml-json

 json_diff
"Bare document"
null
"%!PS-Adobe-2.0 # Not the first line\n"

perl-syck-json

 json_diff
"Bare document ... # No document ... | %!PS-Adobe-2.0"

c-libyaml-event

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

dotnet-yamldotnet-json

 error
Unhandled exception. YamlDotNet.Core.YamlException: (Line: 6, Col: 1, Idx: 36) - (Line: 8, Col: 1, Idx: 74): Expected 'StreamEnd', got 'DocumentStart' (at Line: 6, Col: 1, Idx: 36).
   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
"Bare document"
yaml: line 5: 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 0x564c07295ed0

perl-pplibyaml-json

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

    did not find expected <document start>

was found at , line: 6, column: 1

perl-pplibyaml-perl

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

    did not find expected <document start>

was found at , line: 6, column: 1

perl-tiny-json

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

perl-tiny-perl

 error
YAML::Tiny failed to classify line 'Bare' 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: 6, column: 1

perl-xs-perl

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

    did not find expected <document start>

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

perl-yaml-json

 error
YAML Error: Expected separator '---'
   Code: YAML_PARSE_ERR_NO_SEPARATOR
   Line: 1
   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: 1
   Document: 2
 at /perl5/lib/perl5/YAML/Loader.pm line 88.

py-pyyaml-event

 error
+STR
+DOC
=VAL :Bare document
-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 '<scalar>'
  in "<unicode string>", line 6, column 1:
    |
    ^

py-pyyaml-json

 error
"Bare document"
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 '<scalar>'
  in "<unicode string>", line 6, column 1:
    |
    ^

py-pyyaml-py

 error
'Bare document'
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 '<scalar>'
  in "<unicode string>", line 6, column 1:
    |
    ^

py-ruamel-event

 error
+STR
+DOC
=VAL :Bare document
-DOC ...
+DOC
Traceback (most recent call last):
  File "/yaml/bin/py-ruamel-event", line 9, in <module>
    for event in yaml.parse(sys.stdin.read()):
  File "/python/lib/python3.12/site-packages/ruamel/yaml/main.py", line 371, in parse
    while parser.check_event():
          ^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/parser.py", line 141, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/parser.py", line 349, in parse_block_node
    return self.parse_node(block=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/parser.py", line 516, in parse_node
    raise ParserError(
ruamel.yaml.parser.ParserError: while parsing a block node
expected the node content, but found '<document end>'
  in "<unicode string>", line 5, column 1:
    ...
    ^ (line: 5)

py-ruamel-json

 error
"Bare document"
Traceback (most recent call last):
  File "/yaml/bin/py-ruamel-json", line 21, in <module>
    for doc in yaml.load_all(sys.stdin.read()):
  File "/python/lib/python3.12/site-packages/ruamel/yaml/main.py", line 476, in load_all
    yield constructor.get_data()
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 110, in get_data
    return self.construct_document(self.composer.get_node())
                                   ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 63, in get_node
    return self.compose_document()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 94, in compose_document
    node = self.compose_node(None, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 106, in compose_node
    if self.parser.check_event(AliasEvent):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/parser.py", line 141, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/parser.py", line 349, in parse_block_node
    return self.parse_node(block=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/parser.py", line 516, in parse_node
    raise ParserError(
ruamel.yaml.parser.ParserError: while parsing a block node
expected the node content, but found '<document end>'
  in "<unicode string>", line 5, column 1:
    ...
    ^ (line: 5)

py-ruamel-py

 error
'Bare document'
Traceback (most recent call last):
  File "/yaml/bin/py-ruamel-py", line 38, in <module>
    for doc in yaml.load_all(sys.stdin.read()):
  File "/python/lib/python3.12/site-packages/ruamel/yaml/main.py", line 476, in load_all
    yield constructor.get_data()
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 110, in get_data
    return self.construct_document(self.composer.get_node())
                                   ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 63, in get_node
    return self.compose_document()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 94, in compose_document
    node = self.compose_node(None, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 106, in compose_node
    if self.parser.check_event(AliasEvent):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/parser.py", line 141, in check_event
    self.current_event = self.state()
                         ^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/parser.py", line 349, in parse_block_node
    return self.parse_node(block=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/parser.py", line 516, in parse_node
    raise ParserError(
ruamel.yaml.parser.ParserError: while parsing a block node
expected the node content, but found '<document end>'
  in "<unicode string>", line 5, column 1:
    ...
    ^ (line: 5)

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 :Bare document
-DOC
Error: ScanError { mark: Marker { index: 38, line: 7, col: 0 }, 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 +NODE|
   1    0    0    0 +VAL |
   1    0    0    0 =TEXT|Bare
   1    4    4    4 =FOLD|\x0a
   2    0    5    5 =TEXT|document
   2    8   13   13 -VAL |
   2    8   13   13 -NODE|
   2    8   13   13 =EOL |\x0a
   3    0   14   14 -DOC |
   3    0   14   14 =FOOT|...
   3    3   17   17 =EOL |\x0a
   4    0   18   18 +COMM|
   4    0   18   18 =SYNX|#
   4    1   19   19 =META|.No.document
   4   13   31   31 -COMM|
   4   13   31   31 =EOL |\x0a
   5    0   32   32 =FOOT|...
   5    3   35   35 =EOL |\x0a
   6    0   36   36 +DOC |
   6    0   36   36 +NODE|
   6    0   36   36 +VAL |
   6    0   36   36 =SYNX||
   6    1   37   37 =EOL |\x0a
   7    0   38   38 =TEXT|%!PS-Adobe-2.0.#.Not.the.first.line
   7   35   73   73 =NEWL|\x0a
   8    0   74   74 -VAL |
   8    0   74   74 -NODE|
   8    0   74   74 -DOC |

perl-pp-perl

 na
'Bare document'
'%!PS-Adobe-2.0 # Not the first line
'

perl-syck-perl

 na
'Bare document ... # No document ... | %!PS-Adobe-2.0'