# YAML Test Matrix

--- &test-5TYM
  Title: Spec Example 6.21. Local Tag Prefix
  Tags: [ directive, spec, tag ]

YAML

%TAG !m! !my-
--- # Bulb here
!m!light fluorescent
...
%TAG !m! !my-
--- # Color here
!m!light green

Expected Events

+STR
+DOC ---
=VAL <!my-light> :fluorescent
-DOC ...
+DOC ---
=VAL <!my-light> :green
-DOC
-STR

Expected JSON



cpp-event

 ok

hs-yaml-event

 ok

java-event

 ok

libyaml-event

 ok

nimyaml-event

 ok

perl5-pegex-event

 ok

perl5-pp-event

 ok

pyyaml-event

 ok

ruamel-event

 ok

java-json

 error
Exception in thread "main" Can't construct a java object for !my-light; exception=Invalid tag: !my-light
 in 'reader', line 3, column 1:
    !m!light fluorescent
    ^

	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: !my-light
	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-yaml-json

 error
YAMLException: unknown tag !<!my-light> at line 4, column 1:
    ...
    ^
    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:410:26)
    at Object.exports.run (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:173:23)
    at compileScript (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:224:29)
    at compilePath (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:174:14)
    at Object.exports.run (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:98:20)
    at Object.<anonymous> (/usr/local/lib/node_modules/coffee-script/bin/coffee:15:45)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)
    at node.js:966:3

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-syck-json

 error
Syck parser (line 3, column 8): syntax error at /lib/perl5/x86_64-linux-gnu-thread-multi/YAML/Syck.pm line 75, <> line 1.

perl5-syck-pl

 error
Syck parser (line 3, column 8): syntax error at /lib/perl5/x86_64-linux-gnu-thread-multi/YAML/Syck.pm line 75, <> line 1.

perl5-tiny-json

 error
YAML::Tiny failed to classify line '%TAG !m! !my-' at /bin/perl5-tiny-json line 12.

perl5-tiny-pl

 error
YAML::Tiny failed to classify line '%TAG !m! !my-' at /bin/perl5-tiny-pl line 15.

hs-yaml-json

 na
"fluorescent"
"green"

luajit-json

 na
"fluorescent"
"green"

perl5-pp-json

 na
"fluorescent"
"green"

perl5-pp-pl

 na
'fluorescent'
'green'

perl5-xs-json

 na
"fluorescent"
"green"

perl5-xs-pl

 na
'fluorescent'
'green'

pyyaml-json

 na
"fluorescent"
"green"

pyyaml-py

 na
GenericScalar(tag=u'!my-light', content=u'fluorescent')
GenericScalar(tag=u'!my-light', content=u'green')

ruamel-json

 na
"fluorescent"
"green"

ruamel-py

 na
GenericScalar(tag=u'!my-light', content=u'fluorescent')
GenericScalar(tag=u'!my-light', content=u'green')

ruby-json

 na
"fluorescent"
"green"