# YAML Test Matrix

--- &test-BEC7
  Title: Spec Example 6.14. “YAML” directive
  Tags: [ directive, spec ]

YAML

%YAML 1.3 # Attempt parsing
          # with a warning
---
"foo"

Expected Events

+STR
+DOC ---
=VAL "foo
-DOC
-STR

Expected JSON

"foo"

cpp-event

 ok

hs-yaml-event

 ok

java-event

 ok

js-event

 ok

nimyaml-event

 ok

perl5-pp-event

 ok

pyyaml-event

 ok

ruamel-event

 ok

hs-yaml-json

 json_ok

java-json

 json_ok

js-json

 json_ok

js-yaml-json

 json_ok

perl5-pp-json

 json_ok

pyyaml-json

 json_ok

ruamel-json

 json_ok

perl5-syck-json

 json_diff
"%YAML 1.3"
"foo"

libyaml-event

 error
+STR
Parse error: found incompatible YAML document

luajit-json

 error
luajit: found incompatible YAML document at document: 0

stack traceback:
	[C]: in function 'load'
	/bin/luajit-json:6: in main chunk
	[C]: at 0x004044a0

perl5-pegex-event

 error
Error parsing Pegex document:
  msg:      Parse document failed for some reason
  line:     1
  column:   1
  context:  %YAML 1.3 # Attempt parsing\n          # with a war
            ^
  position: 0 (0 pre-lookahead)
 at /bin/perl5-pegex-event line 23.

perl5-pm-json

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

perl5-pm-pl

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

perl5-tiny-json

 error
YAML::Tiny failed to classify line '"foo"' at /bin/perl5-tiny-json line 12.

perl5-tiny-pl

 error
YAML::Tiny failed to classify line '"foo"' at /bin/perl5-tiny-pl line 15.

perl5-xs-json

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

    found incompatible YAML document

was found at document: 1

perl5-xs-pl

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

    found incompatible YAML document

was found at document: 1

ruby-json

 error
/usr/lib/ruby/2.3.0/psych.rb:380:in `parse': (<unknown>): found incompatible YAML document at line 1 column 1 (Psych::SyntaxError)
	from /usr/lib/ruby/2.3.0/psych.rb:380:in `parse_stream'
	from /usr/lib/ruby/2.3.0/psych.rb:463:in `load_stream'
	from /bin/ruby-json:6:in `<main>'

perl5-pp-pl

 na
'foo'
Found reserved directive '%YAML 1.3 # Attempt parsing' at /lib/perl5/YAML/PP/Lexer.pm line 781, <> line 1.

perl5-syck-pl

 na
'%YAML 1.3'
'foo'

pyyaml-py

 na
'foo'

ruamel-py

 na
'foo'