# YAML Test Matrix

--- &test-6CK3
  Title: Spec Example 6.26. Tag Shorthands
  Tags: [ spec, tag ]

YAML

%TAG !e! tag:example.com,2000:app/
---
- !local foo
- !!str bar
- !e!tag%21 baz

Expected Events

+STR
+DOC ---
+SEQ
=VAL <!local> :foo
=VAL <tag:yaml.org,2002:str> :bar
=VAL <tag:example.com,2000:app/tag!> :baz
-SEQ
-DOC
-STR

Expected JSON



hs-yaml-event

 ok

java-event

 ok

js-event

 ok

libyaml-event

 ok

nimyaml-event

 ok

perl5-pegex-event

 ok

perl5-pp-event

 ok

pyyaml-event

 ok

ruamel-event

 ok

cpp-event

 diff
Minimal Events:
+STR
+DOC
+SEQ
=VAL <!local> :foo
=VAL <tag:yaml.org,2002:str> :bar
=VAL <tag:example.com,2000:app/tag!> :baz
-SEQ
-DOC
-STR
Transformed Events:
+STR
+DOC
+SEQ
=VAL <!local> :foo
=VAL <tag:yaml.org,2002:str> :bar
=VAL <tag:example.com,2000:app/tag%21> :baz
-SEQ
-DOC
-STR
Got Events:
+STR
+DOC
+SEQ
=VAL <!local> :foo
=VAL <tag:yaml.org,2002:str> :bar
=VAL <tag:example.com,2000:app/tag%21> :baz
-SEQ
-DOC
-STR

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-pl

 error
YAML::Tiny failed to classify line '%TAG !e! tag:example.com,2000:app/' at /bin/perl5-tiny-pl line 15.

perl5-xs-pl

 error
YAML::XS Error: bad tag found for scalar: 'tag:example.com,2000:app/tag!' at /bin/perl5-xs-pl line 16, <> line 1.

hs-yaml-json

 na
["foo","bar","baz"]

java-json

 na
Exception in thread "main" Can't construct a java object for !local; exception=Invalid tag: !local
 in 'reader', line 3, column 3:
    - !local foo
      ^

	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.constructSequenceStep2(BaseConstructor.java:364)
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructSequence(BaseConstructor.java:348)
	at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlSeq.construct(SafeConstructor.java:499)
	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: !local
	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)
	... 12 more

js-json

 na
[
  "foo",
  "bar",
  "baz"
]

js-yaml-json

 na
YAMLException: unknown tag !<!local> at line 3, column 13:
    - !local foo
                ^
    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
["foo","bar","baz"]

perl5-pm-json

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

perl5-pp-json

 na
[
   "foo",
   "bar",
   "baz"
]

perl5-pp-pl

 na
[
  'foo',
  'bar',
  'baz'
]

perl5-syck-json

 na
"%TAG !e! tag:example.com,2000:app/ --- - !local foo - !!str bar - !e!tag%21 baz"

perl5-syck-pl

 na
'%TAG !e! tag:example.com,2000:app/ --- - !local foo - !!str bar - !e!tag%21 baz'

perl5-tiny-json

 na
YAML::Tiny failed to classify line '%TAG !e! tag:example.com,2000:app/' at /bin/perl5-tiny-json line 12.

perl5-xs-json

 na
YAML::XS Error: bad tag found for scalar: 'tag:example.com,2000:app/tag!' at /bin/perl5-xs-json line 14, <> line 1.

pyyaml-json

 na
[
  "foo", 
  "bar", 
  "baz"
]

pyyaml-py

 na
[GenericScalar(tag=u'!local', content=u'foo'),
 'bar',
 GenericScalar(tag=u'tag:example.com,2000:app/tag!', content=u'baz')]

ruamel-json

 na
[
  "foo", 
  "bar", 
  "baz"
]

ruamel-py

 na
[GenericScalar(tag=u'!local', content=u'foo'),
 'bar',
 GenericScalar(tag=u'tag:example.com,2000:app/tag!', content=u'baz')]

ruby-json

 na
["foo","bar","baz"]