# YAML Test Matrix

--- &test-RHX7
  Title: YAML directive without document end marker
  Tags: [ directive, error ]

YAML

---
key: value
%YAML 1.2
---

Expected Events

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

Expected JSON



c-libyaml-event

 invalid_incorrect
+STR
+DOC ---
+MAP
=VAL :key
=VAL :value
-MAP
-DOC
+DOC ---
=VAL :
-DOC
-STR

cpp-yamlcpp-event

 invalid_incorrect
+STR
+DOC
+MAP
=VAL :key
=VAL :value
-MAP
-DOC
+DOC
=VAL :
-DOC
-STR

java-snakeyaml-event

 invalid_incorrect
+STR
+DOC ---
+MAP
=VAL :key
=VAL :value
-MAP
-DOC
+DOC ---
=VAL :
-DOC
-STR

java-snakeyaml-json

 invalid_incorrect
{
  "key": "value"
}
null

perl-pplibyaml-event

 invalid_incorrect
+STR
+DOC ---
+MAP
=VAL :key
=VAL :value
-MAP
-DOC
+DOC ---
=VAL :
-DOC
-STR

perl-pplibyaml-json

 invalid_incorrect
{
   "key" : "value"
}
null

perl-pplibyaml-perl

 invalid_incorrect
{
  'key' => 'value'
}
undef

perl-xs-json

 invalid_incorrect
{
   "key" : "value"
}
null

perl-xs-perl

 invalid_incorrect
{
  'key' => 'value'
}
undef

py-pyyaml-event

 invalid_incorrect
+STR
+DOC ---
+MAP
=VAL :key
=VAL :value
-MAP
-DOC
+DOC ---
=VAL :
-DOC
-STR

py-pyyaml-json

 invalid_incorrect
{
  "key": "value"
}
null

py-pyyaml-py

 invalid_incorrect
{'key': 'value'}
None

py-ruamel-event

 invalid_incorrect
+STR
+DOC ---
+MAP
=VAL :key
=VAL :value
-MAP
-DOC
+DOC ---
=VAL :
-DOC
-STR

py-ruamel-json

 invalid_incorrect
{
  "key": "value"
}
null

py-ruamel-py

 invalid_incorrect
{'key': 'value'}
None

c-libfyaml-event

 invalid_correct
stdin:3:7: error: missing explicit document end marker before directive(s)
%YAML 1.2
      ^~~
+STR
+DOC ---
+MAP
=VAL :key
=VAL :value
-MAP

c-libfyaml-json

 invalid_correct
stdin:3:7: error: missing explicit document end marker before directive(s)
%YAML 1.2
      ^~~

dotnet-yamldotnet-event

 invalid_correct
Unhandled exception. YamlDotNet.Core.SemanticErrorException: (Line: 3, Col: 1, Idx: 15) - (Line: 3, Col: 1, Idx: 15): Did not find expected <document end>.
   at YamlDotNet.Core.Parser.ParseDocumentEnd()
   at YamlDotNet.Core.Parser.StateMachine()
   at YamlDotNet.Core.Parser.MoveNext()
   at Program.ConvertToLibYamlStyleAnnotatedEventStream(TextReader textReader, TextWriter textWriter)
   at Program.Main(String[] commandLineArguments)
Aborted (core dumped)
+STR
+DOC ---
+MAP
=VAL :key
=VAL :value
-MAP

dotnet-yamldotnet-json

 invalid_correct
Unhandled exception. YamlDotNet.Core.SemanticErrorException: (Line: 3, Col: 1, Idx: 15) - (Line: 3, Col: 1, Idx: 15): Did not find expected <document end>.
   at YamlDotNet.Core.Parser.ParseDocumentEnd()
   at YamlDotNet.Core.Parser.StateMachine()
   at YamlDotNet.Core.Parser.MoveNext()
   at YamlDotNet.Core.ParserExtensions.Allow[T](IParser parser)
   at YamlDotNet.Core.ParserExtensions.Expect[T](IParser parser)
   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 = 15, posCharOffset = 15, posLine = 3, posColumn = 0} (Unexpected '%')
+STR
+DOC ---
+MAP
=VAL :key
=VAL :value
-MAP
-DOC

hs-hsyaml-json

 invalid_correct
hsyaml-parser: user error (Unexpected '%')

js-jsyaml-json

 invalid_correct
/node/node_modules/js-yaml/lib/js-yaml/loader.js:173
  throw generateError(state, message);
  ^
YAMLException: end of the stream or a document separator is expected at line 3, column 1:
    %YAML 1.2
    ^
    at generateError (/node/node_modules/js-yaml/lib/js-yaml/loader.js:167:10)
    at throwError (/node/node_modules/js-yaml/lib/js-yaml/loader.js:173:9)
    at readDocument (/node/node_modules/js-yaml/lib/js-yaml/loader.js:1539:5)
    at loadDocuments (/node/node_modules/js-yaml/lib/js-yaml/loader.js:1575:5)
    at Object.loadAll (/node/node_modules/js-yaml/lib/js-yaml/loader.js:1583:19)
    at Object.<anonymous> (/yaml/bin/js-jsyaml-json:7:13)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)

js-yaml-event

 invalid_correct
Implicit map keys need to be followed by map values
+STR
+DOC ---
+MAP
=VAL :key
=VAL :value

js-yaml-json

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

YAMLSemanticError: Implicit map keys need to be followed by map values
    at resolveBlockMapItems (/node/node_modules/yaml/dist/resolveSeq-4a68b39b.js:1810:33)
    at Object.resolveMap [as resolve] (/node/node_modules/yaml/dist/resolveSeq-4a68b39b.js:1612:79)
    at resolveByTagName (/node/node_modules/yaml/dist/resolveSeq-4a68b39b.js:1384:25)
    at resolveTag (/node/node_modules/yaml/dist/resolveSeq-4a68b39b.js:1414:17)
    at resolveNodeValue (/node/node_modules/yaml/dist/resolveSeq-4a68b39b.js:1535:23)
    at Object.resolveNode (/node/node_modules/yaml/dist/resolveSeq-4a68b39b.js:1583:15)
    at parseContents (/node/node_modules/yaml/dist/Document-2cf6b08c.js:357:30)
    at Document.parse (/node/node_modules/yaml/dist/Document-2cf6b08c.js:615:5)
    at Object.parseAllDocuments (/node/node_modules/yaml/dist/index.js:34:9)
    at Object.<anonymous> (/yaml/bin/js-yaml-json:7:19)

lua-lyaml-json

 invalid_correct
luajit: 3:1: found incompatible YAML document
stack traceback:
	[C]: in function 'error'
	/usr/local/share/lua/5.1/lyaml/init.lua:291: in function 'error'
	/usr/local/share/lua/5.1/lyaml/init.lua:310: in function 'parse'
	/usr/local/share/lua/5.1/lyaml/init.lua:481: in function 'load'
	/yaml/bin/lua-lyaml-json:6: in main chunk
	[C]: at 0x55adea251f97

nim-nimyaml-event

 invalid_correct
/buildutils/nimyaml_event.nim(8) nimyaml_event
/tmp/NimYAML-0.13.1/yaml/stream.nim(223) finished
Error: unhandled exception: Missing mapping value indicator (`:`) [YamlStreamError]
+STR
+DOC ---
+MAP
=VAL :key
=VAL :value

perl-pp-event

 invalid_correct
Line      : 3
Column    : 1
Expected  : ALIAS COLON DOC_END DOC_START EOL PLAIN QUESTION QUOTED
Got       : YAML_DIRECTIVE
Where     : /perl5/lib/perl5/YAML/PP/Parser.pm line 386
YAML      : "%YAML 1.2"
  at /yaml/bin/perl-pp-event line 25.
+STR
+DOC ---
+MAP
=VAL :key
=VAL :value

perl-pp-json

 invalid_correct
Line      : 3
Column    : 1
Expected  : ALIAS COLON DOC_END DOC_START EOL PLAIN QUESTION QUOTED
Got       : YAML_DIRECTIVE
Where     : /perl5/lib/perl5/YAML/PP/Parser.pm line 386
YAML      : "%YAML 1.2"
  at /perl5/lib/perl5/YAML/PP/Loader.pm line 92.

perl-pp-perl

 invalid_correct
Line      : 3
Column    : 1
Expected  : ALIAS COLON DOC_END DOC_START EOL PLAIN QUESTION QUOTED
Got       : YAML_DIRECTIVE
Where     : /perl5/lib/perl5/YAML/PP/Parser.pm line 386
YAML      : "%YAML 1.2"
  at /perl5/lib/perl5/YAML/PP/Loader.pm line 92.

perl-syck-json

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

perl-syck-perl

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

perl-tiny-json

 invalid_correct
YAML::Tiny failed to classify line '%YAML 1.2' at /yaml/bin/perl-tiny-json line 12.

perl-tiny-perl

 invalid_correct
YAML::Tiny failed to classify line '%YAML 1.2' at /yaml/bin/perl-tiny-perl line 15.

perl-yaml-json

 invalid_correct
Use of uninitialized value in sprintf at /perl5/lib/perl5/YAML/Error.pm line 18, <> line 1.
YAML Error: Can't parse inline implicit value ''
   Code: YAML_PARSE_ERR_BAD_INLINE_IMPLICIT
   Line: 3
   Document: 1
 at /perl5/lib/perl5/YAML/Loader.pm line 607.

perl-yaml-perl

 invalid_correct
Use of uninitialized value in sprintf at /perl5/lib/perl5/YAML/Error.pm line 18, <> line 1.
YAML Error: Can't parse inline implicit value ''
   Code: YAML_PARSE_ERR_BAD_INLINE_IMPLICIT
   Line: 3
   Document: 1
 at /perl5/lib/perl5/YAML/Loader.pm line 607.

ruby-psych-json

 invalid_correct
/usr/lib/ruby/2.5.0/psych.rb:405:in `parse': (<unknown>): found incompatible YAML document at line 1 column 1 (Psych::SyntaxError)
	from /usr/lib/ruby/2.5.0/psych.rb:405:in `parse_stream'
	from /usr/lib/ruby/2.5.0/psych.rb:488:in `load_stream'
	from /yaml/bin/ruby-psych-json:6:in `<main>'