# YAML Test Matrix

--- &test-M5DY
  Title: Spec Example 2.11. Mapping between Sequences
  Tags: [ mapping, sequence, spec ]

YAML

? - Detroit Tigers
  - Chicago cubs
:
  - 2001-07-23

? [ New York Yankees,
    Atlanta Braves ]
: [ 2001-07-02, 2001-08-12,
    2001-08-14 ]

Expected Events

+STR
+DOC
+MAP
+SEQ
=VAL :Detroit Tigers
=VAL :Chicago cubs
-SEQ
+SEQ
=VAL :2001-07-23
-SEQ
+SEQ
=VAL :New York Yankees
=VAL :Atlanta Braves
-SEQ
+SEQ
=VAL :2001-07-02
=VAL :2001-08-12
=VAL :2001-08-14
-SEQ
-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-pp-event

 ok

pyyaml-event

 ok

ruamel-event

 ok

perl5-pegex-event

 error
Maximum parsing rules reached (1000)

perl5-pm-pl

 error
YAML Error: Inconsistent indentation level
   Code: YAML_PARSE_ERR_INCONSISTENT_INDENTATION
   Line: 2
   Document: 1
 at /lib/perl5/YAML/Loader.pm line 804.

perl5-tiny-pl

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

pyyaml-py

 error
Traceback (most recent call last):
  File "/bin/pyyaml-py", line 36, in <module>
    for doc in yaml.load_all(sys.stdin.read()):
  File "/lib/python2.7/site-packages/yaml/__init__.py", line 90, in load_all
    yield loader.get_data()
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 33, in get_data
    return self.construct_document(self.get_node())
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 48, in construct_document
    for dummy in generator:
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 398, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 208, in construct_mapping
    return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 132, in construct_mapping
    "found unacceptable key (%s)" % exc, key_node.start_mark)
yaml.constructor.ConstructorError: while constructing a mapping
  in "<string>", line 1, column 1:
    ? - Detroit Tigers
    ^
found unacceptable key (unhashable type: 'list')
  in "<string>", line 1, column 3:
    ? - Detroit Tigers
      ^

hs-yaml-json

 na
{"[\"Detroit Tigers\",\"Chicago cubs\"]":["2001-07-23"],"[\"New York Yankees\",\"Atlanta Braves\"]":["2001-07-02","2001-08-12","2001-08-14"]}

java-json

 na
{
  "[Detroit Tigers, Chicago cubs]": [
    "Jul 23, 2001 12:00:00 AM"
  ],
  "[New York Yankees, Atlanta Braves]": [
    "Jul 2, 2001 12:00:00 AM",
    "Aug 12, 2001 12:00:00 AM",
    "Aug 14, 2001 12:00:00 AM"
  ]
}

js-json

 na
{
  "[\"Detroit Tigers\",\"Chicago cubs\"]": [
    "2001-07-23"
  ],
  "[\"New York Yankees\",\"Atlanta Braves\"]": [
    "2001-07-02",
    "2001-08-12",
    "2001-08-14"
  ]
}

js-yaml-json

 na
{
  "Detroit Tigers,Chicago cubs": [
    "2001-07-23T00:00:00.000Z"
  ],
  "New York Yankees,Atlanta Braves": [
    "2001-07-02T00:00:00.000Z",
    "2001-08-12T00:00:00.000Z",
    "2001-08-14T00:00:00.000Z"
  ]
}

luajit-json

 na
luajit: /bin/luajit-json:8: Cannot serialise table: table key must be a number or string
stack traceback:
	[C]: in function 'encode'
	/bin/luajit-json:8: in main chunk
	[C]: at 0x004044a0

perl5-pm-json

 na
YAML Error: Inconsistent indentation level
   Code: YAML_PARSE_ERR_INCONSISTENT_INDENTATION
   Line: 2
   Document: 1
 at /lib/perl5/YAML/Loader.pm line 804.

perl5-pp-json

 na
{
   "['Detroit Tigers','Chicago cubs']" : [
      "2001-07-23"
   ],
   "['New York Yankees','Atlanta Braves']" : [
      "2001-07-02",
      "2001-08-12",
      "2001-08-14"
   ]
}

perl5-pp-pl

 na
{
  '[\'Detroit Tigers\',\'Chicago cubs\']' => [
                                               '2001-07-23'
                                             ],
  '[\'New York Yankees\',\'Atlanta Braves\']' => [
                                                   '2001-07-02',
                                                   '2001-08-12',
                                                   '2001-08-14'
                                                 ]
}

perl5-syck-json

 na
{
   "ARRAY(0x2341758)" : [
      "2001-07-23"
   ],
   "ARRAY(0x23527d8)" : [
      "2001-07-02",
      "2001-08-12",
      "2001-08-14"
   ]
}

perl5-syck-pl

 na
{
  'ARRAY(0x1e48ca0)' => [
                          '2001-07-23'
                        ],
  'ARRAY(0x1e56718)' => [
                          '2001-07-02',
                          '2001-08-12',
                          '2001-08-14'
                        ]
}

perl5-tiny-json

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

perl5-xs-json

 na
{
   "ARRAY(0x8718a0)" : [
      "2001-07-02",
      "2001-08-12",
      "2001-08-14"
   ],
   "ARRAY(0x871930)" : [
      "2001-07-23"
   ]
}

perl5-xs-pl

 na
{
  'ARRAY(0x196f5c8)' => [
                          '2001-07-23'
                        ],
  'ARRAY(0x196fcb8)' => [
                          '2001-07-02',
                          '2001-08-12',
                          '2001-08-14'
                        ]
}

pyyaml-json

 na
Traceback (most recent call last):
  File "/bin/pyyaml-json", line 19, in <module>
    for doc in yaml.load_all(sys.stdin.read()):
  File "/lib/python2.7/site-packages/yaml/__init__.py", line 90, in load_all
    yield loader.get_data()
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 33, in get_data
    return self.construct_document(self.get_node())
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 48, in construct_document
    for dummy in generator:
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 398, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 208, in construct_mapping
    return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 132, in construct_mapping
    "found unacceptable key (%s)" % exc, key_node.start_mark)
yaml.constructor.ConstructorError: while constructing a mapping
  in "<string>", line 1, column 1:
    ? - Detroit Tigers
    ^
found unacceptable key (unhashable type: 'list')
  in "<string>", line 1, column 3:
    ? - Detroit Tigers
      ^

ruamel-json

 na
{
  
}

ruamel-py

 na
{('Detroit Tigers', 'Chicago cubs'): [datetime.date(2001, 7, 23)],
 ('New York Yankees', 'Atlanta Braves'): [datetime.date(2001, 7, 2),
                                          datetime.date(2001, 8, 12),
                                          datetime.date(2001, 8, 14)]}

ruby-json

 na
{"[\"Detroit Tigers\", \"Chicago cubs\"]":["2001-07-23"],"[\"New York Yankees\", \"Atlanta Braves\"]":["2001-07-02","2001-08-12","2001-08-14"]}