# YAML Test Matrix

--- &test-S98Z
  Title: Block scalar with more spaces than first content line
  Tags: [ comment, error, folded, scalar, whitespace ]

YAML

empty block scalar: >
 
  
   
 # comment

Expected Events

+STR
+DOC
+MAP
=VAL :empty block scalar

Expected JSON



c-libyaml-event

 invalid_incorrect
+STR
+DOC
+MAP
=VAL :empty block scalar
=VAL >
-MAP
-DOC
-STR

cpp-yamlcpp-event

 invalid_incorrect
+STR
+DOC
+MAP
=VAL :empty block scalar
=VAL :
-MAP
-DOC
-STR

java-snakeyaml-event

 invalid_incorrect
+STR
+DOC
+MAP
=VAL :empty block scalar
=VAL >
-MAP
-DOC
-STR

java-snakeyaml-json

 invalid_incorrect
{
  "empty block scalar": ""
}

js-jsyaml-json

 invalid_incorrect
{"empty block scalar":""}

lua-lyaml-json

 invalid_incorrect
{"empty block scalar":""}

perl-pp-event

 invalid_incorrect
+STR
+DOC
+MAP
=VAL :empty block scalar
=VAL >
-MAP
-DOC
-STR

perl-pp-json

 invalid_incorrect
{
   "empty block scalar" : ""
}

perl-pp-perl

 invalid_incorrect
{
  'empty block scalar' => ''
}

perl-pplibyaml-event

 invalid_incorrect
+STR
+DOC
+MAP
=VAL :empty block scalar
=VAL >
-MAP
-DOC
-STR

perl-pplibyaml-json

 invalid_incorrect
{
   "empty block scalar" : ""
}

perl-pplibyaml-perl

 invalid_incorrect
{
  'empty block scalar' => ''
}

perl-syck-json

 invalid_incorrect
{
   "empty block scalar" : "\n\n\n# comment\n"
}

perl-syck-perl

 invalid_incorrect
{
  'empty block scalar' => '


# comment
'
}

perl-xs-json

 invalid_incorrect
{
   "empty block scalar" : ""
}

perl-xs-perl

 invalid_incorrect
{
  'empty block scalar' => ''
}

perl-yaml-json

 invalid_incorrect
{
   "empty block scalar" : "\n \n  \n# comment\n"
}

perl-yaml-perl

 invalid_incorrect
{
  'empty block scalar' => '
 
  
# comment
'
}

py-pyyaml-event

 invalid_incorrect
+STR
+DOC
+MAP
=VAL :empty block scalar
=VAL >
-MAP
-DOC
-STR

py-pyyaml-json

 invalid_incorrect
{
  "empty block scalar": ""
}

py-pyyaml-py

 invalid_incorrect
{'empty block scalar': ''}

py-ruamel-event

 invalid_incorrect
+STR
+DOC
+MAP
=VAL :empty block scalar
=VAL >
-MAP
-DOC
-STR

py-ruamel-json

 invalid_incorrect
{
  "empty block scalar": ""
}

py-ruamel-py

 invalid_incorrect
{'empty block scalar': ''}

ruby-psych-json

 invalid_incorrect
{"empty block scalar":""}

c-libfyaml-event

 invalid_correct
stdin:2:1: error: empty block scalar with wrongly indented comment line after spaces only
 
^
  
~~
   
~~~
 # comment
~
[NOT]: fy_fetch_block_scalar() failed
[NOT]: fy_fetch_tokens() failed
[NOT]: failed to peek token
+STR
+DOC
+MAP
=VAL :empty block scalar

c-libfyaml-json

 invalid_correct
stdin:2:1: error: empty block scalar with wrongly indented comment line after spaces only
 
^
  
~~
   
~~~
 # comment
~
[NOT]: fy_fetch_block_scalar() failed
[NOT]: fy_fetch_tokens() failed
[NOT]: failed to peek token

dotnet-yamldotnet-event

 invalid_correct
Unhandled exception. YamlDotNet.Core.SemanticErrorException: (Line: 5, Col: 1, Idx: 31) - (Line: 5, Col: 2, Idx: 32): While scanning a literal block scalar, found more spaces in lines above first content line.
   at YamlDotNet.Core.Scanner.ScanBlockScalarBreaks(Int32 currentIndent, StringBuilder breaks, Boolean isLiteral, Mark& end, Nullable`1& isFirstLine)
   at YamlDotNet.Core.Scanner.ScanBlockScalar(Boolean isLiteral)
   at YamlDotNet.Core.Scanner.FetchBlockScalar(Boolean isLiteral)
   at YamlDotNet.Core.Scanner.FetchNextToken()
   at YamlDotNet.Core.Scanner.FetchMoreTokens()
   at YamlDotNet.Core.Scanner.MoveNextWithoutConsuming()
   at YamlDotNet.Core.Parser.GetCurrentToken()
   at YamlDotNet.Core.Parser.ParseBlockMappingValue()
   at YamlDotNet.Core.Parser.StateMachine()
   at YamlDotNet.Core.Parser.MoveNext()
   at YamlDotNet.RepresentationModel.LibYamlEventStream.WriteTo(TextWriter textWriter)
   at Program.Main(String[] commandLineArguments)
Aborted (core dumped)
+STR
+DOC
+MAP
=VAL :empty block scalar

dotnet-yamldotnet-json

 invalid_correct
Unhandled exception. YamlDotNet.Core.SemanticErrorException: (Line: 5, Col: 1, Idx: 31) - (Line: 5, Col: 2, Idx: 32): While scanning a literal block scalar, found more spaces in lines above first content line.
   at YamlDotNet.Core.Scanner.ScanBlockScalarBreaks(Int32 currentIndent, StringBuilder breaks, Boolean isLiteral, Mark& end, Nullable`1& isFirstLine)
   at YamlDotNet.Core.Scanner.ScanBlockScalar(Boolean isLiteral)
   at YamlDotNet.Core.Scanner.FetchBlockScalar(Boolean isLiteral)
   at YamlDotNet.Core.Scanner.FetchNextToken()
   at YamlDotNet.Core.Scanner.FetchMoreTokens()
   at YamlDotNet.Core.Scanner.MoveNextWithoutConsuming()
   at YamlDotNet.Core.Parser.GetCurrentToken()
   at YamlDotNet.Core.Parser.ParseBlockMappingValue()
   at YamlDotNet.Core.Parser.StateMachine()
   at YamlDotNet.Core.Parser.MoveNext()
   at YamlDotNet.Core.ParserExtensions.TryConsume[T](IParser parser, T& event)
   at YamlDotNet.Serialization.NodeDeserializers.ScalarNodeDeserializer.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)
   at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
   at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.<>c__DisplayClass3_0.<DeserializeValue>b__0(IParser r, Type t)
   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)
   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)

hs-hsyaml-event

 invalid_correct
Parsing error near byte offset Pos {posByteOffset = 42, posCharOffset = 42, posLine = 6, posColumn = 0} (leading empty lines contain more spaces than the first non-empty line in scalar: "\n \n  \n# comment\n")
+STR
+DOC
+MAP
=VAL :empty block scalar

hs-hsyaml-json

 invalid_correct
hsyaml-parser: user error (leading empty lines contain more spaces than the first non-empty line in scalar: "\n \n  \n# comment\n")

js-yaml-event

 invalid_correct
Block scalars with more-indented leading empty lines must use an explicit indentation indicator at line 5, column 2:

   
 # comment
 ^
+STR
+DOC
+MAP
=VAL :empty block scalar
=VAL >\n \n  \n# comment\n
-MAP
-DOC
-STR

js-yaml-json

 invalid_correct
/yaml/bin/js-yaml-json:8
  if (doc.errors.length !== 0) throw doc.errors[0]
                               ^

YAMLParseError: Block scalars with more-indented leading empty lines must use an explicit indentation indicator at line 5, column 2:

   
 # comment
 ^

    at Composer.onError (/node/node_modules/yaml/dist/compose/composer.js:71:34)
    at Object.resolveBlockScalar (/node/node_modules/yaml/dist/compose/resolve-block-scalar.js:42:17)
    at Object.composeScalar (/node/node_modules/yaml/dist/compose/compose-scalar.js:10:30)
    at composeNode (/node/node_modules/yaml/dist/compose/compose-node.js:23:34)
    at Object.resolveBlockMap (/node/node_modules/yaml/dist/compose/resolve-block-map.js:73:19)
    at Object.composeCollection (/node/node_modules/yaml/dist/compose/compose-collection.js:13:36)
    at Object.composeNode (/node/node_modules/yaml/dist/compose/compose-node.js:30:38)
    at Object.composeDoc (/node/node_modules/yaml/dist/compose/compose-doc.js:31:23)
    at Composer.next (/node/node_modules/yaml/dist/compose/composer.js:152:40)
    at next (<anonymous>)

nim-nimyaml-event

 invalid_correct
/tmp/NimYAML-0.16.0/yaml/stream.nim(134) nimyaml_event
/tmp/NimYAML-0.16.0/yaml/stream.nim(106) next
Error: unhandled exception: Leading all-spaces line contains too many spaces [YamlStreamError]
+STR
+DOC
+MAP
=VAL :empty block scalar

perl-refparser-event

 invalid_correct
Spaces found after indent in auto-detect (5LLU) at /perl5/lib/perl5/YAML/Parser.pm line 4564, <> line 1.

perl-tiny-json

 invalid_correct
YAML::Tiny failed to find multi-line scalar content at /yaml/bin/perl-tiny-json line 12.

perl-tiny-perl

 invalid_correct
YAML::Tiny failed to find multi-line scalar content at /yaml/bin/perl-tiny-perl line 15.