# YAML Test Matrix

--- &test-4QFQ
  Title: Spec Example 8.2. Block Indentation Indicator [1.3]
  Tags: [ 1.3-mod, folded, libyaml-err, literal, scalar, spec, whitespace ]

YAML

- |
 detected
- >
 
  
  # detected
- |1
  explicit
- >
 detected

Expected Events

+STR
+DOC
+SEQ
=VAL |detected\n
=VAL >\n\n# detected\n
=VAL | explicit\n
=VAL >detected\n
-SEQ
-DOC
-STR

Expected JSON

[
"detected\n",
"\n\n# detected\n",
" explicit\n",
"detected\n"
]

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

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

ruby-psych-json

 json_ok

perl-yaml-json

 json_diff
[
  "detected\n",
  "\n \n # detected\n",
  " explicit\n",
  "detected\n"
]

perl-tiny-json

 error
YAML::Tiny found bad indenting in line '- |1' at /yaml/bin/perl-tiny-json line 12.

perl-tiny-perl

 error
YAML::Tiny found bad indenting in line '- |1' at /yaml/bin/perl-tiny-perl line 15.

py-ruamel-event

 error
+STR
+DOC
+SEQ
=VAL |detected\n
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 538, in parse_block_sequence_entry
    if not self.scanner.check_token(BlockEntryToken, BlockEndToken):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/scanner.py", line 170, in check_token
    self.fetch_more_tokens()
  File "/python/lib/python3.12/site-packages/ruamel/yaml/scanner.py", line 298, in fetch_more_tokens
    return self.fetch_folded()
           ^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/scanner.py", line 683, in fetch_folded
    self.fetch_block_scalar(style='>')
  File "/python/lib/python3.12/site-packages/ruamel/yaml/scanner.py", line 691, in fetch_block_scalar
    self.tokens.append(self.scan_block_scalar(style))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/scanner.py", line 1128, in scan_block_scalar
    breaks, max_indent, end_mark = self.scan_block_scalar_indentation()
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/scanner.py", line 1317, in scan_block_scalar_indentation
    raise ScannerError(
ruamel.yaml.scanner.ScannerError: more indented follow up line than first in a block scalar
  in "<unicode string>", line 6, column 3:
      # detected
      ^ (line: 6)

py-ruamel-json

 error
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 128, in compose_node
    node = self.compose_sequence_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 172, in compose_sequence_node
    while not self.parser.check_event(SequenceEndEvent):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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 538, in parse_block_sequence_entry
    if not self.scanner.check_token(BlockEntryToken, BlockEndToken):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/scanner.py", line 170, in check_token
    self.fetch_more_tokens()
  File "/python/lib/python3.12/site-packages/ruamel/yaml/scanner.py", line 298, in fetch_more_tokens
    return self.fetch_folded()
           ^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/scanner.py", line 683, in fetch_folded
    self.fetch_block_scalar(style='>')
  File "/python/lib/python3.12/site-packages/ruamel/yaml/scanner.py", line 691, in fetch_block_scalar
    self.tokens.append(self.scan_block_scalar(style))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/scanner.py", line 1128, in scan_block_scalar
    breaks, max_indent, end_mark = self.scan_block_scalar_indentation()
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/scanner.py", line 1317, in scan_block_scalar_indentation
    raise ScannerError(
ruamel.yaml.scanner.ScannerError: more indented follow up line than first in a block scalar
  in "<unicode string>", line 6, column 3:
      # detected
      ^ (line: 6)

py-ruamel-py

 error
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 128, in compose_node
    node = self.compose_sequence_node(anchor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/composer.py", line 172, in compose_sequence_node
    while not self.parser.check_event(SequenceEndEvent):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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 538, in parse_block_sequence_entry
    if not self.scanner.check_token(BlockEntryToken, BlockEndToken):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/scanner.py", line 170, in check_token
    self.fetch_more_tokens()
  File "/python/lib/python3.12/site-packages/ruamel/yaml/scanner.py", line 298, in fetch_more_tokens
    return self.fetch_folded()
           ^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/scanner.py", line 683, in fetch_folded
    self.fetch_block_scalar(style='>')
  File "/python/lib/python3.12/site-packages/ruamel/yaml/scanner.py", line 691, in fetch_block_scalar
    self.tokens.append(self.scan_block_scalar(style))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/scanner.py", line 1128, in scan_block_scalar
    breaks, max_indent, end_mark = self.scan_block_scalar_indentation()
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/python/lib/python3.12/site-packages/ruamel/yaml/scanner.py", line 1317, in scan_block_scalar_indentation
    raise ScannerError(
ruamel.yaml.scanner.ScannerError: more indented follow up line than first in a block scalar
  in "<unicode string>", line 6, column 3:
      # detected
      ^ (line: 6)

hs-reference-yeast

 na
Line  Col Char Byte Token|Content
   1    0    0    0 +DOC |
   1    0    0    0 +NODE|
   1    0    0    0 +SEQ |
   1    0    0    0 =SYNX|-
   1    1    1    1 +NODE|
   1    1    1    1 =WSPC|.
   1    2    2    2 +VAL |
   1    2    2    2 =SYNX||
   1    3    3    3 =EOL |\x0a
   2    0    4    4 =DENT|.
   2    1    5    5 =TEXT|detected
   2    9   13   13 =NEWL|\x0a
   3    0   14   14 -VAL |
   3    0   14   14 -NODE|
   3    0   14   14 =SYNX|-
   3    1   15   15 +NODE|
   3    1   15   15 =WSPC|.
   3    2   16   16 +VAL |
   3    2   16   16 =SYNX|>
   3    3   17   17 =EOL |\x0a
   4    0   18   18 =DENT|.
   4    1   19   19 =NEWL|\x0a
   5    0   20   20 =DENT|.
   5    1   21   21 =TEXT|.
   5    2   22   22 =NEWL|\x0a
   6    0   23   23 =DENT|.
   6    1   24   24 =TEXT|.#.detected
   6   12   35   35 =NEWL|\x0a
   7    0   36   36 -VAL |
   7    0   36   36 -NODE|
   7    0   36   36 =SYNX|-
   7    1   37   37 +NODE|
   7    1   37   37 =WSPC|.
   7    2   38   38 +VAL |
   7    2   38   38 =SYNX||
   7    3   39   39 =SYNX|1
   7    4   40   40 =EOL |\x0a
   8    0   41   41 =DENT|.
   8    1   42   42 =TEXT|.explicit
   8   10   51   51 =NEWL|\x0a
   9    0   52   52 -VAL |
   9    0   52   52 -NODE|
   9    0   52   52 =SYNX|-
   9    1   53   53 +NODE|
   9    1   53   53 =WSPC|.
   9    2   54   54 +VAL |
   9    2   54   54 =SYNX|>
   9    3   55   55 =EOL |\x0a
  10    0   56   56 =DENT|.
  10    1   57   57 =TEXT|detected
  10    9   65   65 =NEWL|\x0a
  11    0   66   66 -VAL |
  11    0   66   66 -NODE|
  11    0   66   66 -SEQ |
  11    0   66   66 -NODE|
  11    0   66   66 -DOC |

perl-pp-perl

 na
[
  'detected
',
  '

# detected
',
  ' explicit
',
  'detected
'
]

perl-pplibyaml-perl

 na
[
  'detected
',
  '

# detected
',
  ' explicit
',
  'detected
'
]

perl-syck-perl

 na
[
  'detected
',
  '

# detected
',
  ' explicit
',
  'detected
'
]

perl-xs-perl

 na
[
  'detected
',
  '

# detected
',
  ' explicit
',
  'detected
'
]

perl-yaml-perl

 na
[
  'detected
',
  '
 
 # detected
',
  ' explicit
',
  'detected
'
]

py-pyyaml-py

 na
['detected\n', '\n\n# detected\n', ' explicit\n', 'detected\n']