# YAML Test Matrix

--- &test-9WXW
  Title: Spec Example 6.18. Primary Tag Handle
  Tags: [ 1.3-err, directive, spec, tag ]

YAML

# Private
!foo "bar"
...
# Global
%TAG ! tag:example.com,2000:app/
---
!foo "bar"

Expected Events

+STR
+DOC
=VAL <!foo> "bar
-DOC ...
+DOC ---
=VAL <tag:example.com,2000:app/foo> "bar
-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:     5
  column:   1
  context:  %TAG ! tag:example.com,2000:app/\n---\n!foo "bar"\n
            ^
  position: 34 (0 pre-lookahead)
 at /bin/perl5-pegex-event line 23.

perl5-pm-pl

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

perl5-tiny-pl

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

perl5-xs-pl

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

hs-yaml-json

 na
"bar"
"bar"

java-json

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

	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: !foo
	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
"bar"
"bar"

js-yaml-json

 na
YAMLException: unknown tag !<!foo> at line 2, column 11:
    !foo "bar"
              ^
    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 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
"bar"
"bar"

perl5-pm-json

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

perl5-pp-json

 na
"bar"
"bar"

perl5-pp-pl

 na
'bar'
'bar'

perl5-syck-json

 na
"bar"
"%TAG ! tag:example.com,2000:app/ --- !foo \"bar\""

perl5-syck-pl

 na
'bar'
'%TAG ! tag:example.com,2000:app/ --- !foo "bar"'

perl5-tiny-json

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

perl5-xs-json

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

pyyaml-json

 na
"bar"
"bar"

pyyaml-py

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

ruamel-json

 na
"bar"
"bar"

ruamel-py

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

ruby-json

 na
"bar"
"bar"