# YAML Test Matrix

--- &test-77H8
  Title: Spec Example 2.23. Various Explicit Tags
  Tags: [ spec, tag ]

YAML

---
not-date: !!str 2002-04-28

picture: !!binary |
 R0lGODlhDAAMAIQAAP//9/X
 17unp5WZmZgAAAOfn515eXv
 Pz7Y6OjuDg4J+fn5OTk6enp
 56enmleECcgggoBADs=

application specific tag: !something |
 The semantics of the tag
 above may be different for
 different documents.

Expected Events

+STR
+DOC ---
+MAP
=VAL :not-date
=VAL <tag:yaml.org,2002:str> :2002-04-28
=VAL :picture
=VAL <tag:yaml.org,2002:binary> |R0lGODlhDAAMAIQAAP//9/X\n17unp5WZmZgAAAOfn515eXv\nPz7Y6OjuDg4J+fn5OTk6enp\n56enmleECcgggoBADs=\n
=VAL :application specific tag
=VAL <!something> |The semantics of the tag\nabove may be different for\ndifferent documents.\n
-MAP
-DOC
-STR

Expected JSON



cpp-event

 ok

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

perl5-tiny-pl

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

perl5-xs-pl

 error
YAML::XS Error: bad tag found for scalar: 'tag:yaml.org,2002:binary' at /bin/perl5-xs-pl line 16, <> line 1.

hs-yaml-json

 na
{"application specific tag":"The semantics of the tag\nabove may be different for\ndifferent documents.\n","not-date":"2002-04-28","picture":"R0lGODlhDAAMAIQAAP//9/X\n17unp5WZmZgAAAOfn515eXv\nPz7Y6OjuDg4J+fn5OTk6enp\n56enmleECcgggoBADs=\n"}

java-json

 na
Exception in thread "main" Can't construct a java object for !something; exception=Invalid tag: !something
 in 'reader', line 10, column 27:
    application specific tag: !something |
                              ^

	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.constructMapping2ndStep(BaseConstructor.java:453)
	at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:184)
	at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:434)
	at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:521)
	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: !something
	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)
	... 13 more

js-json

 na
{
  "not-date": "2002-04-28",
  "picture": "R0lGODlhDAAMAIQAAP//9/X\n17unp5WZmZgAAAOfn515eXv\nPz7Y6OjuDg4J+fn5OTk6enp\n56enmleECcgggoBADs=\n",
  "application specific tag": "The semantics of the tag\nabove may be different for\ndifferent documents.\n"
}

js-yaml-json

 na
YAMLException: unknown tag !<!something> at line 14, 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 readBlockMapping (/node_modules/js-yaml/lib/js-yaml/loader.js:1062:11)
    at composeNode (/node_modules/js-yaml/lib/js-yaml/loader.js:1332: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
{"picture":"GIF89a\f\u0000\f\u0000�\u0000\u0000���������fff\u0000\u0000\u0000���^^^��펎����������������i^\u0010' �\n\u0001\u0000;","not-date":"2002-04-28","application specific tag":"The semantics of the tag\nabove may be different for\ndifferent documents.\n"}

perl5-pm-json

 na
{
   "application specific tag" : "The semantics of the tag\nabove may be different for\ndifferent documents.\n",
   "not-date" : "2002-04-28",
   "picture" : "R0lGODlhDAAMAIQAAP//9/X\n17unp5WZmZgAAAOfn515eXv\nPz7Y6OjuDg4J+fn5OTk6enp\n56enmleECcgggoBADs=\n"
}

perl5-pm-pl

 na
{
  'application specific tag' => 'The semantics of the tag
above may be different for
different documents.
',
  'not-date' => '2002-04-28',
  'picture' => 'R0lGODlhDAAMAIQAAP//9/X
17unp5WZmZgAAAOfn515eXv
Pz7Y6OjuDg4J+fn5OTk6enp
56enmleECcgggoBADs=
'
}

perl5-pp-json

 na
{
   "application specific tag" : "The semantics of the tag\nabove may be different for\ndifferent documents.\n",
   "not-date" : "2002-04-28",
   "picture" : "R0lGODlhDAAMAIQAAP//9/X\n17unp5WZmZgAAAOfn515eXv\nPz7Y6OjuDg4J+fn5OTk6enp\n56enmleECcgggoBADs=\n"
}

perl5-pp-pl

 na
{
  'application specific tag' => 'The semantics of the tag
above may be different for
different documents.
',
  'not-date' => '2002-04-28',
  'picture' => 'R0lGODlhDAAMAIQAAP//9/X
17unp5WZmZgAAAOfn515eXv
Pz7Y6OjuDg4J+fn5OTk6enp
56enmleECcgggoBADs=
'
}

perl5-syck-json

 na
{
   "application specific tag" : "The semantics of the tag\nabove may be different for\ndifferent documents.\n",
   "not-date" : "2002-04-28",
   "picture" : "GIF89a\f\u0000\f\u0000\u0084\u0000\u0000\u00ff\u00ff"
}

perl5-syck-pl

 na
{
  'application specific tag' => 'The semantics of the tag
above may be different for
different documents.
',
  'not-date' => '2002-04-28',
  'picture' => 'GIF89a���'
}

perl5-tiny-json

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

perl5-xs-json

 na
YAML::XS Error: bad tag found for scalar: 'tag:yaml.org,2002:binary' at /bin/perl5-xs-json line 14, <> line 1.

pyyaml-json

 na
Error json.dumps: <type 'exceptions.UnicodeDecodeError'>
Traceback (most recent call last):
  File "/bin/pyyaml-json", line 21, in <module>
    print json.dumps(doc, sort_keys=True, skipkeys=True, indent=2)
  File "/usr/lib/python2.7/json/__init__.py", line 251, in dumps
    sort_keys=sort_keys, **kw).encode(obj)
  File "/usr/lib/python2.7/json/encoder.py", line 209, in encode
    chunks = list(chunks)
  File "/usr/lib/python2.7/json/encoder.py", line 434, in _iterencode
    for chunk in _iterencode_dict(o, _current_indent_level):
  File "/usr/lib/python2.7/json/encoder.py", line 390, in _iterencode_dict
    yield _encoder(value)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x84 in position 10: invalid start byte

pyyaml-py

 na
{'application specific tag': GenericScalar(tag=u'!something', content=u'The semantics of the tag\nabove may be different for\ndifferent documents.\n'),
 'not-date': '2002-04-28',
 'picture': "GIF89a\x0c\x00\x0c\x00\x84\x00\x00\xff\xff\xf7\xf5\xf5\xee\xe9\xe9\xe5fff\x00\x00\x00\xe7\xe7\xe7^^^\xf3\xf3\xed\x8e\x8e\x8e\xe0\xe0\xe0\x9f\x9f\x9f\x93\x93\x93\xa7\xa7\xa7\x9e\x9e\x9ei^\x10' \x82\n\x01\x00;"}

ruamel-json

 na
Error json.dumps: <type 'exceptions.UnicodeDecodeError'>
Traceback (most recent call last):
  File "/bin/ruamel-json", line 21, in <module>
    print json.dumps(doc, sort_keys=True, skipkeys=True, indent=2)
  File "/usr/lib/python2.7/json/__init__.py", line 251, in dumps
    sort_keys=sort_keys, **kw).encode(obj)
  File "/usr/lib/python2.7/json/encoder.py", line 209, in encode
    chunks = list(chunks)
  File "/usr/lib/python2.7/json/encoder.py", line 434, in _iterencode
    for chunk in _iterencode_dict(o, _current_indent_level):
  File "/usr/lib/python2.7/json/encoder.py", line 390, in _iterencode_dict
    yield _encoder(value)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x84 in position 10: invalid start byte

ruamel-py

 na
{'application specific tag': GenericScalar(tag=u'!something', content=u'The semantics of the tag\nabove may be different for\ndifferent documents.\n'),
 'not-date': '2002-04-28',
 'picture': "GIF89a\x0c\x00\x0c\x00\x84\x00\x00\xff\xff\xf7\xf5\xf5\xee\xe9\xe9\xe5fff\x00\x00\x00\xe7\xe7\xe7^^^\xf3\xf3\xed\x8e\x8e\x8e\xe0\xe0\xe0\x9f\x9f\x9f\x93\x93\x93\xa7\xa7\xa7\x9e\x9e\x9ei^\x10' \x82\n\x01\x00;"}

ruby-json

 na
/usr/lib/ruby/vendor_ruby/json/common.rb:223:in `encode': "\x84" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
	from /usr/lib/ruby/vendor_ruby/json/common.rb:223:in `generate'
	from /usr/lib/ruby/vendor_ruby/json/common.rb:223:in `generate'
	from /usr/lib/ruby/vendor_ruby/json/common.rb:394:in `dump'
	from /bin/ruby-json:7:in `block in <main>'
	from /bin/ruby-json:6:in `each'
	from /bin/ruby-json:6:in `<main>'