# YAML Test Matrix

--- &test-9MMW
  Title: Single Pair Implicit Entries
  Tags: [ flow, mapping, sequence ]

YAML

- [ YAML : separate ]
- [ "JSON like":adjacent ]
- [ {JSON: like}:adjacent ]

Expected Events

+STR
+DOC
+SEQ
+SEQ []
+MAP {}
=VAL :YAML
=VAL :separate
-MAP
-SEQ
+SEQ []
+MAP {}
=VAL "JSON like
=VAL :adjacent
-MAP
-SEQ
+SEQ []
+MAP {}
+MAP {}
=VAL :JSON
=VAL :like
-MAP
=VAL :adjacent
-MAP
-SEQ
-SEQ
-DOC
-STR

Expected JSON



c-libfyaml-event

 ok

c-libyaml-event

 ok

cpp-yamlcpp-event

 ok

dotnet-yamldotnet-event

 ok

hs-hsyaml-event

 ok

java-snakeyaml-event

 ok

js-yaml-event

 ok

nim-nimyaml-event

 ok

perl-pplibyaml-event

 ok

perl-refparser-event

 ok

py-pyyaml-event

 ok

perl-pp-event

 error
+STR
+DOC
+SEQ
+SEQ []
+MAP {}
=VAL :YAML
=VAL :separate
-MAP
-SEQ
+SEQ []
+MAP {}
=VAL "JSON like
=VAL :adjacent
-MAP
-SEQ
+SEQ []
+MAP {}
=VAL :JSON
=VAL :like
-MAP
Line      : 3
Column    : 17
Expected  : EOL FLOWSEQ_END FLOW_COMMA WS
Got       : PLAIN
Where     : /perl5/lib/perl5/YAML/PP/Parser.pm line 392
YAML      : ":adjacent ]"
  at /yaml/bin/perl-pp-event line 25.

perl-pp-perl

 error
Line      : 3
Column    : 17
Expected  : EOL FLOWSEQ_END FLOW_COMMA WS
Got       : PLAIN
Where     : /perl5/lib/perl5/YAML/PP/Parser.pm line 392
YAML      : ":adjacent ]"
  at /perl5/lib/perl5/YAML/PP/Loader.pm line 94.

perl-syck-perl

 error
Syck parser (line 2, column 24): syntax error at /perl5/lib/perl5/x86_64-linux-thread-multi/YAML/Syck.pm line 60, <> line 1.

perl-yaml-perl

 error
YAML Error: Can't parse inline sequence
   Code: YAML_PARSE_ERR_INLINE_SEQUENCE
   Line: 2
   Document: 1
 at /perl5/lib/perl5/YAML/Loader.pm line 551.

py-pyyaml-py

 error
Traceback (most recent call last):
  File "/yaml/bin/py-pyyaml-py", line 36, in <module>
    for doc in yaml.load_all(sys.stdin.read(), Loader=yaml.FullLoader):
  File "/python/lib/python3.7/site-packages/yaml/__init__.py", line 130, in load_all
    yield loader.get_data()
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 45, in get_data
    return self.construct_document(self.get_node())
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 60, in construct_document
    for dummy in generator:
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 413, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 218, in construct_mapping
    return super().construct_mapping(node, deep=deep)
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 142, in construct_mapping
    "found unhashable key", key_node.start_mark)
yaml.constructor.ConstructorError: while constructing a mapping
found unhashable key
  in "<unicode string>", line 3, column 5:
    - [ {JSON: like}:adjacent ]
        ^

py-ruamel-event

 error
+STR
+DOC
+SEQ
+SEQ []
+MAP {}
=VAL :YAML
=VAL :separate
-MAP
-SEQ
+SEQ []
=VAL "JSON like
Traceback (most recent call last):
  File "/yaml/bin/py-ruamel-event", line 7, in <module>
    for event in ruamel.yaml.parse(sys.stdin.read()):
  File "/python/lib/python3.7/site-packages/ruamel/yaml/main.py", line 907, in parse
    while loader._parser.check_event():
  File "/python/lib/python3.7/site-packages/ruamel/yaml/parser.py", line 140, in check_event
    self.current_event = self.state()
  File "/python/lib/python3.7/site-packages/ruamel/yaml/parser.py", line 656, in parse_flow_sequence_entry
    token.start_mark,
ruamel.yaml.parser.ParserError: while parsing a flow sequence
  in "<unicode string>", line 2, column 3:
    - [ "JSON like":adjacent ]
      ^ (line: 2)
expected ',' or ']', but got '<scalar>'
  in "<unicode string>", line 2, column 16:
    - [ "JSON like":adjacent ]
                   ^ (line: 2)

py-ruamel-py

 error
Traceback (most recent call last):
  File "/yaml/bin/py-ruamel-py", line 36, in <module>
    for doc in ruamel.yaml.load_all(sys.stdin.read(), Loader=ruamel.yaml.Loader):
  File "/python/lib/python3.7/site-packages/ruamel/yaml/main.py", line 976, in load_all
    yield loader._constructor.get_data()
  File "/python/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 106, in get_data
    return self.construct_document(self.composer.get_node())
  File "/python/lib/python3.7/site-packages/ruamel/yaml/composer.py", line 68, in get_node
    return self.compose_document()
  File "/python/lib/python3.7/site-packages/ruamel/yaml/composer.py", line 101, in compose_document
    node = self.compose_node(None, None)
  File "/python/lib/python3.7/site-packages/ruamel/yaml/composer.py", line 136, in compose_node
    node = self.compose_sequence_node(anchor)
  File "/python/lib/python3.7/site-packages/ruamel/yaml/composer.py", line 180, in compose_sequence_node
    node.value.append(self.compose_node(node, index))
  File "/python/lib/python3.7/site-packages/ruamel/yaml/composer.py", line 136, in compose_node
    node = self.compose_sequence_node(anchor)
  File "/python/lib/python3.7/site-packages/ruamel/yaml/composer.py", line 179, in compose_sequence_node
    while not self.parser.check_event(SequenceEndEvent):
  File "/python/lib/python3.7/site-packages/ruamel/yaml/parser.py", line 140, in check_event
    self.current_event = self.state()
  File "/python/lib/python3.7/site-packages/ruamel/yaml/parser.py", line 656, in parse_flow_sequence_entry
    token.start_mark,
ruamel.yaml.parser.ParserError: while parsing a flow sequence
  in "<unicode string>", line 2, column 3:
    - [ "JSON like":adjacent ]
      ^ (line: 2)
expected ',' or ']', but got '<scalar>'
  in "<unicode string>", line 2, column 16:
    - [ "JSON like":adjacent ]
                   ^ (line: 2)

c-libfyaml-json

 na
[
  [
    {
      "YAML": "separate"
    }
  ],
  [
    {
      "JSON like": "adjacent"
    }
  ],
  [
    {
  ]
]
stdin:3:5: error: Non scalar keys are not allowed in JSON emit mode
- [ {JSON: like}:adjacent ]
    ^~~~~~~~~~~~

dotnet-yamldotnet-json

 na
[[{"YAML": "separate"}], [{"JSON like": "adjacent"}], [{? {"JSON": "like"} : "adjacent"}]]

hs-hsyaml-json

 na
[[{"YAML":"separate"}],[{"JSON like":"adjacent"}],[{"{\"JSON\":\"like\"}":"adjacent"}]]

java-snakeyaml-json

 na
[
  [
    {
      "YAML": "separate"
    }
  ],
  [
    {
      "JSON like": "adjacent"
    }
  ],
  [
    {
      "{JSON\u003dlike}": "adjacent"
    }
  ]
]

js-jsyaml-json

 na
[[{"YAML":"separate"}],[{"JSON like":"adjacent"}],[{"[object Object]":"adjacent"}]]

js-yaml-json

 na
[
  [
    {
      "YAML": "separate"
    }
  ],
  [
    {
      "JSON like": "adjacent"
    }
  ],
  [
    {
      "{ JSON: like }": "adjacent"
    }
  ]
]
(node:1227) Warning: Keys with collection values will be stringified due to JS Object restrictions: "{ JSON: like }". Set mapAsMap: true to use object keys.

lua-lyaml-json

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

perl-pp-json

 na
Line      : 3
Column    : 17
Expected  : EOL FLOWSEQ_END FLOW_COMMA WS
Got       : PLAIN
Where     : /perl5/lib/perl5/YAML/PP/Parser.pm line 392
YAML      : ":adjacent ]"
  at /perl5/lib/perl5/YAML/PP/Loader.pm line 94.

perl-pplibyaml-json

 na
[
   [
      {
         "YAML" : "separate"
      }
   ],
   [
      {
         "JSON like" : "adjacent"
      }
   ],
   [
      {
         "{JSON => 'like'}" : "adjacent"
      }
   ]
]

perl-pplibyaml-perl

 na
[
  [
    {
      'YAML' => 'separate'
    }
  ],
  [
    {
      'JSON like' => 'adjacent'
    }
  ],
  [
    {
      '{JSON => \'like\'}' => 'adjacent'
    }
  ]
]

perl-syck-json

 na
Syck parser (line 2, column 24): syntax error at /perl5/lib/perl5/x86_64-linux-thread-multi/YAML/Syck.pm line 60, <> line 1.

perl-tiny-json

 na
YAML::Tiny found illegal characters in plain scalar: '[ YAML : separate ]' at /yaml/bin/perl-tiny-json line 12.

perl-xs-json

 na
[
   [
      {
         "YAML" : "separate"
      }
   ],
   [
      {
         "JSON like" : "adjacent"
      }
   ],
   [
      {
         "HASH(0x55c435d27b18)" : "adjacent"
      }
   ]
]

perl-xs-perl

 na
[
  [
    {
      'YAML' => 'separate'
    }
  ],
  [
    {
      'JSON like' => 'adjacent'
    }
  ],
  [
    {
      'HASH(0x56354102f180)' => 'adjacent'
    }
  ]
]

perl-yaml-json

 na
YAML Error: Can't parse inline sequence
   Code: YAML_PARSE_ERR_INLINE_SEQUENCE
   Line: 2
   Document: 1
 at /perl5/lib/perl5/YAML/Loader.pm line 551.

py-pyyaml-json

 na
Traceback (most recent call last):
  File "/yaml/bin/py-pyyaml-json", line 19, in <module>
    for doc in yaml.load_all(sys.stdin.read(), Loader=yaml.FullLoader):
  File "/python/lib/python3.7/site-packages/yaml/__init__.py", line 130, in load_all
    yield loader.get_data()
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 45, in get_data
    return self.construct_document(self.get_node())
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 60, in construct_document
    for dummy in generator:
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 413, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 218, in construct_mapping
    return super().construct_mapping(node, deep=deep)
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 142, in construct_mapping
    "found unhashable key", key_node.start_mark)
yaml.constructor.ConstructorError: while constructing a mapping
found unhashable key
  in "<unicode string>", line 3, column 5:
    - [ {JSON: like}:adjacent ]
        ^

py-ruamel-json

 na
Traceback (most recent call last):
  File "/yaml/bin/py-ruamel-json", line 19, in <module>
    for doc in ruamel.yaml.load_all(sys.stdin.read(), Loader=ruamel.yaml.Loader):
  File "/python/lib/python3.7/site-packages/ruamel/yaml/main.py", line 976, in load_all
    yield loader._constructor.get_data()
  File "/python/lib/python3.7/site-packages/ruamel/yaml/constructor.py", line 106, in get_data
    return self.construct_document(self.composer.get_node())
  File "/python/lib/python3.7/site-packages/ruamel/yaml/composer.py", line 68, in get_node
    return self.compose_document()
  File "/python/lib/python3.7/site-packages/ruamel/yaml/composer.py", line 101, in compose_document
    node = self.compose_node(None, None)
  File "/python/lib/python3.7/site-packages/ruamel/yaml/composer.py", line 136, in compose_node
    node = self.compose_sequence_node(anchor)
  File "/python/lib/python3.7/site-packages/ruamel/yaml/composer.py", line 180, in compose_sequence_node
    node.value.append(self.compose_node(node, index))
  File "/python/lib/python3.7/site-packages/ruamel/yaml/composer.py", line 136, in compose_node
    node = self.compose_sequence_node(anchor)
  File "/python/lib/python3.7/site-packages/ruamel/yaml/composer.py", line 179, in compose_sequence_node
    while not self.parser.check_event(SequenceEndEvent):
  File "/python/lib/python3.7/site-packages/ruamel/yaml/parser.py", line 140, in check_event
    self.current_event = self.state()
  File "/python/lib/python3.7/site-packages/ruamel/yaml/parser.py", line 656, in parse_flow_sequence_entry
    token.start_mark,
ruamel.yaml.parser.ParserError: while parsing a flow sequence
  in "<unicode string>", line 2, column 3:
    - [ "JSON like":adjacent ]
      ^ (line: 2)
expected ',' or ']', but got '<scalar>'
  in "<unicode string>", line 2, column 16:
    - [ "JSON like":adjacent ]
                   ^ (line: 2)

ruby-psych-json

 na
[[{"YAML":"separate"}],[{"JSON like":"adjacent"}],[{"{\"JSON\"=>\"like\"}":"adjacent"}]]

perl-tiny-perl

 ni
YAML::Tiny found illegal characters in plain scalar: '[ YAML : separate ]' at /yaml/bin/perl-tiny-perl line 15.