# YAML Test Matrix

--- &test-C4HZ
  Title: Spec Example 2.24. Global Tags
  Tags: [ alias, directive, spec, tag ]

YAML

%TAG ! tag:clarkevans.com,2002:
--- !shape
  # Use the ! handle for presenting
  # tag:clarkevans.com,2002:circle
- !circle
  center: &ORIGIN {x: 73, y: 129}
  radius: 7
- !line
  start: *ORIGIN
  finish: { x: 89, y: 102 }
- !label
  start: *ORIGIN
  color: 0xFFEEBB
  text: Pretty vector drawing.

Expected Events

+STR
+DOC ---
+SEQ <tag:clarkevans.com,2002:shape>
+MAP <tag:clarkevans.com,2002:circle>
=VAL :center
+MAP &ORIGIN
=VAL :x
=VAL :73
=VAL :y
=VAL :129
-MAP
=VAL :radius
=VAL :7
-MAP
+MAP <tag:clarkevans.com,2002:line>
=VAL :start
=ALI *ORIGIN
=VAL :finish
+MAP
=VAL :x
=VAL :89
=VAL :y
=VAL :102
-MAP
-MAP
+MAP <tag:clarkevans.com,2002:label>
=VAL :start
=ALI *ORIGIN
=VAL :color
=VAL :0xFFEEBB
=VAL :text
=VAL :Pretty vector drawing.
-MAP
-SEQ
-DOC
-STR

Expected JSON



cpp-event

 ok

hs-yaml-event

 ok

java-event

 ok

js-event

 ok

libyaml-event

 ok

nimyaml-event

 ok

perl5-pp-event

 ok

pyyaml-event

 ok

ruamel-event

 ok

perl5-pegex-event

 error
Error parsing Pegex document:
  msg:      Parse document failed for some reason
  line:     1
  column:   1
  context:  %TAG ! tag:clarkevans.com,2002:\n--- !shape\n  # Use
            ^
  position: 0 (0 pre-lookahead)
 at /bin/perl5-pegex-event line 23.

perl5-pm-pl

 error
Use of uninitialized value in sprintf at /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: 1
   Document: 1
 at /lib/perl5/YAML/Loader.pm line 607.

perl5-tiny-pl

 error
YAML::Tiny does not support a feature in line '!shape' at /bin/perl5-tiny-pl line 15.

perl5-xs-pl

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

    bad tag found for hash: 'tag:clarkevans.com,2002:circle'

was found at document: 1

hs-yaml-json

 na
[{"center":{"x":73,"y":129},"radius":7},{"finish":{"x":89,"y":102},"start":{"x":73,"y":129}},{"color":16772795,"start":{"x":73,"y":129},"text":"Pretty vector drawing."}]

java-json

 na
Exception in thread "main" Can't construct a java object for tag:clarkevans.com,2002:shape; exception=Invalid tag: tag:clarkevans.com,2002:shape
 in 'reader', line 2, column 5:
    --- !shape
        ^

	at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:314)
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:204)
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:193)
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:159)
	at org.yaml.snakeyaml.constructor.BaseConstructor.getData(BaseConstructor.java:127)
	at org.yaml.snakeyaml.Yaml$1.next(Yaml.java:547)
	at org.yaml.editor.Snake2Json.yamlToJson(Snake2Json.java:18)
	at org.yaml.editor.Snake2Json.main(Snake2Json.java:25)
Caused by: org.yaml.snakeyaml.error.YAMLException: Invalid tag: tag:clarkevans.com,2002:shape
	at org.yaml.snakeyaml.nodes.Tag.getClassName(Tag.java:112)
	at org.yaml.snakeyaml.constructor.Constructor.getClassForNode(Constructor.java:637)
	at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.getConstructor(Constructor.java:300)
	at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:309)
	... 7 more

js-json

 na
[
  {
    "center": {
      "x": 73,
      "y": 129
    },
    "radius": 7
  },
  {
    "start": {
      "x": 73,
      "y": 129
    },
    "finish": {
      "x": 89,
      "y": 102
    }
  },
  {
    "start": {
      "x": 73,
      "y": 129
    },
    "color": 16772795,
    "text": "Pretty vector drawing."
  }
]

js-yaml-json

 na
YAMLException: unknown tag !<tag:clarkevans.com,2002:circle> at line 8, column 1:
    - !line
    ^
    at generateError (/node_modules/js-yaml/lib/js-yaml/loader.js:165:10)
    at throwError (/node_modules/js-yaml/lib/js-yaml/loader.js:171:9)
    at composeNode (/node_modules/js-yaml/lib/js-yaml/loader.js:1401:7)
    at readBlockSequence (/node_modules/js-yaml/lib/js-yaml/loader.js:928:5)
    at composeNode (/node_modules/js-yaml/lib/js-yaml/loader.js:1331:12)
    at readDocument (/node_modules/js-yaml/lib/js-yaml/loader.js:1492:3)
    at loadDocuments (/node_modules/js-yaml/lib/js-yaml/loader.js:1548:5)
    at Object.loadAll (/node_modules/js-yaml/lib/js-yaml/loader.js:1556:19)
    at Object.<anonymous> (/bin/js-yaml-json:6:6)
    at Object.<anonymous> (/bin/js-yaml-json:3:1)
    at Module._compile (module.js:652:30)
    at Object.exports.run (/usr/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:173:23)
    at compileScript (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:224:29)
    at compilePath (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:174:14)
    at Object.exports.run (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:98:20)
    at Object.<anonymous> (/usr/lib/node_modules/coffee-script/bin/coffee:15:45)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3

luajit-json

 na
[{"radius":7,"center":{"y":129,"x":73}},{"start":{"y":129,"x":73},"finish":{"y":102,"x":89}},{"text":"Pretty vector drawing.","start":{"y":129,"x":73},"color":0}]

perl5-pm-json

 na
Use of uninitialized value in sprintf at /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: 1
   Document: 1
 at /lib/perl5/YAML/Loader.pm line 607.

perl5-pp-json

 na
[
   {
      "center" : {
         "x" : 73,
         "y" : 129
      },
      "radius" : 7
   },
   {
      "finish" : {
         "x" : 89,
         "y" : 102
      },
      "start" : {
         "x" : 73,
         "y" : 129
      }
   },
   {
      "color" : 16772795,
      "start" : {
         "x" : 73,
         "y" : 129
      },
      "text" : "Pretty vector drawing."
   }
]

perl5-pp-pl

 na
[
  {
    'center' => {
                'x' => 73,
                'y' => 129
              },
    'radius' => 7
  },
  {
    'finish' => {
                'x' => 89,
                'y' => 102
              },
    'start' => $VAR1->[0]{'center'}
  },
  {
    'color' => 16772795,
    'start' => $VAR1->[0]{'center'},
    'text' => 'Pretty vector drawing.'
  }
]

perl5-syck-json

 na
{
   "%TAG ! tag:clarkevans.com,2002" : null
}
null

perl5-syck-pl

 na
{
  '%TAG ! tag:clarkevans.com,2002' => undef
}
bless( [
         bless( {
                  'center' => {
                              '1' => 129,
                              'x' => 73
                            },
                  'radius' => 7
                }, 'circle' ),
         bless( {
                  'finish' => {
                              '1' => 102,
                              'x' => 89
                            },
                  'start' => $VAR2->[0]{'center'}
                }, 'line' ),
         bless( {
                  'color' => 16772795,
                  'start' => $VAR2->[0]{'center'},
                  'text' => 'Pretty vector drawing.'
                }, 'label' )
       ], 'shape' )

perl5-tiny-json

 na
YAML::Tiny does not support a feature in line '!shape' at /bin/perl5-tiny-json line 12.

perl5-xs-json

 na
YAML::XS::Load Error: The problem:

    bad tag found for hash: 'tag:clarkevans.com,2002:circle'

was found at document: 1

pyyaml-json

 na
[
  {
    "center": {
      "x": 73, 
      "y": 129
    }, 
    "radius": 7
  }, 
  {
    "finish": {
      "x": 89, 
      "y": 102
    }, 
    "start": {
      "x": 73, 
      "y": 129
    }
  }, 
  {
    "color": 16772795, 
    "start": {
      "x": 73, 
      "y": 129
    }, 
    "text": "Pretty vector drawing."
  }
]

pyyaml-py

 na
GenericSequence(tag=u'tag:clarkevans.com,2002:shape', content=[GenericMapping(tag=u'tag:clarkevans.com,2002:circle', content={'radius': 7, 'center': {'y': 129, 'x': 73}}), GenericMapping(tag=u'tag:clarkevans.com,2002:line', content={'start': {'y': 129, 'x': 73}, 'finish': {'y': 102, 'x': 89}}), GenericMapping(tag=u'tag:clarkevans.com,2002:label', content={'color': 16772795, 'start': {'y': 129, 'x': 73}, 'text': 'Pretty vector drawing.'})])

ruamel-json

 na
[
  {
    "center": {
      "x": 73, 
      "y": 129
    }, 
    "radius": 7
  }, 
  {
    "finish": {
      "x": 89, 
      "y": 102
    }, 
    "start": {
      "x": 73, 
      "y": 129
    }
  }, 
  {
    "color": 16772795, 
    "start": {
      "x": 73, 
      "y": 129
    }, 
    "text": "Pretty vector drawing."
  }
]

ruamel-py

 na
GenericSequence(tag=u'tag:clarkevans.com,2002:shape', content=[GenericMapping(tag=u'tag:clarkevans.com,2002:circle', content={'radius': 7, 'center': {'y': 129, 'x': 73}}), GenericMapping(tag=u'tag:clarkevans.com,2002:line', content={'start': {'y': 129, 'x': 73}, 'finish': {'y': 102, 'x': 89}}), GenericMapping(tag=u'tag:clarkevans.com,2002:label', content={'color': 16772795, 'start': {'y': 129, 'x': 73}, 'text': 'Pretty vector drawing.'})])

ruby-json

 na
[{"center":{"x":73,"y":129},"radius":7},{"start":{"x":73,"y":129},"finish":{"x":89,"y":102}},{"start":{"x":73,"y":129},"color":16772795,"text":"Pretty vector drawing."}]