# YAML Test Matrix

--- &test-74H7
  Title: Tags in Implicit Mapping
  Tags: [ mapping, tag ]

YAML

!!str a: b
c: !!int 42
e: !!str f
g: h
!!str 23: !!bool false

Expected Events

+STR
+DOC
+MAP
=VAL <tag:yaml.org,2002:str> :a
=VAL :b
=VAL :c
=VAL <tag:yaml.org,2002:int> :42
=VAL :e
=VAL <tag:yaml.org,2002:str> :f
=VAL :g
=VAL :h
=VAL <tag:yaml.org,2002:str> :23
=VAL <tag:yaml.org,2002:bool> :false
-MAP
-DOC
-STR

Expected JSON

{
"23": false,
"a": "b",
"c": 42,
"e": "f",
"g": "h"
}

c-libfyaml-event

 ok

c-libyaml-event

 ok

cpp-rapidyaml-event

 ok

cpp-yamlcpp-event

 ok

dotnet-yamldotnet-event

 ok

hs-hsyaml-event

 ok

js-yaml-event

 ok

nim-nimyaml-event

 ok

perl-pp-event

 ok

perl-refparser-event

 ok

py-pyyaml-event

 ok

py-ruamel-event

 ok

rust-yamlrust-event

 ok

c-libfyaml-json

 json_ok

dotnet-yamldotnet-json

 json_ok

go-yaml-json

 json_ok

hs-hsyaml-json

 json_ok

js-yaml-json

 json_ok

lua-lyaml-json

 json_ok

perl-pp-json

 json_ok

perl-pplibyaml-json

 json_ok

py-pyyaml-json

 json_ok

py-ruamel-json

 json_ok

ruby-psych-json

 json_ok

perl-syck-json

 json_diff
{
  "23": "false",
  "a": "b",
  "c": 42,
  "e": "f",
  "g": "h"
}

perl-yaml-json

 json_diff
{
  "23": "false",
  "a": "b",
  "c": 42,
  "e": "f",
  "g": "h"
}

js-jsyaml-json

 error
/node/node_modules/js-yaml/lib/loader.js:187
  throw generateError(state, message);
  ^
YAMLException: end of the stream or a document separator is expected (1:8)

 1 | !!str a: b
------------^
 2 | c: !!int 42
 3 | e: !!str f
    at generateError (/node/node_modules/js-yaml/lib/loader.js:183:10)
    at throwError (/node/node_modules/js-yaml/lib/loader.js:187:9)
    at readDocument (/node/node_modules/js-yaml/lib/loader.js:1645:5)
    at loadDocuments (/node/node_modules/js-yaml/lib/loader.js:1688:5)
    at Object.loadAll (/node/node_modules/js-yaml/lib/loader.js:1701:19)
    at Object.<anonymous> (/yaml/bin/js-jsyaml-json:7:13)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12) {
  reason: 'end of the stream or a document separator is expected',
  mark: {
    name: null,
    buffer: '!!str a: b\nc: !!int 42\ne: !!str f\ng: h\n!!str 23: !!bool false\n',
    position: 7,
    line: 0,
    column: 7,
    snippet: ' 1 | !!str a: b\n------------^\n 2 | c: !!int 42\n 3 | e: !!str f'
  }
}

Node.js v20.13.1

perl-xs-json

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

perl-xs-perl

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

hs-reference-yeast

 na
Line  Col Char Byte Token|Content
   1    0    0    0 +DOC |
   1    0    0    0 +NODE|
   1    0    0    0 +MAP |
   1    0    0    0 +PAIR|
   1    0    0    0 +NODE|
   1    0    0    0 +PROP|
   1    0    0    0 +TAG |
   1    0    0    0 +HAND|
   1    0    0    0 =SYNX|!
   1    1    1    1 =SYNX|!
   1    2    2    2 -HAND|
   1    2    2    2 =META|str
   1    5    5    5 -TAG |
   1    5    5    5 -PROP|
   1    5    5    5 =WSPC|.
   1    6    6    6 +VAL |
   1    6    6    6 =TEXT|a
   1    7    7    7 -VAL |
   1    7    7    7 -NODE|
   1    7    7    7 =SYNX|:
   1    8    8    8 =WSPC|.
   1    9    9    9 +NODE|
   1    9    9    9 +VAL |
   1    9    9    9 =TEXT|b
   1   10   10   10 -VAL |
   1   10   10   10 -NODE|
   1   10   10   10 =EOL |\x0a
   2    0   11   11 -PAIR|
   2    0   11   11 +PAIR|
   2    0   11   11 +NODE|
   2    0   11   11 +VAL |
   2    0   11   11 =TEXT|c
   2    1   12   12 -VAL |
   2    1   12   12 -NODE|
   2    1   12   12 =SYNX|:
   2    2   13   13 =WSPC|.
   2    3   14   14 +NODE|
   2    3   14   14 +PROP|
   2    3   14   14 +TAG |
   2    3   14   14 +HAND|
   2    3   14   14 =SYNX|!
   2    4   15   15 =SYNX|!
   2    5   16   16 -HAND|
   2    5   16   16 =META|int
   2    8   19   19 -TAG |
   2    8   19   19 -PROP|
   2    8   19   19 =WSPC|.
   2    9   20   20 +VAL |
   2    9   20   20 =TEXT|42
   2   11   22   22 -VAL |
   2   11   22   22 -NODE|
   2   11   22   22 =EOL |\x0a
   3    0   23   23 -PAIR|
   3    0   23   23 +PAIR|
   3    0   23   23 +NODE|
   3    0   23   23 +VAL |
   3    0   23   23 =TEXT|e
   3    1   24   24 -VAL |
   3    1   24   24 -NODE|
   3    1   24   24 =SYNX|:
   3    2   25   25 =WSPC|.
   3    3   26   26 +NODE|
   3    3   26   26 +PROP|
   3    3   26   26 +TAG |
   3    3   26   26 +HAND|
   3    3   26   26 =SYNX|!
   3    4   27   27 =SYNX|!
   3    5   28   28 -HAND|
   3    5   28   28 =META|str
   3    8   31   31 -TAG |
   3    8   31   31 -PROP|
   3    8   31   31 =WSPC|.
   3    9   32   32 +VAL |
   3    9   32   32 =TEXT|f
   3   10   33   33 -VAL |
   3   10   33   33 -NODE|
   3   10   33   33 =EOL |\x0a
   4    0   34   34 -PAIR|
   4    0   34   34 +PAIR|
   4    0   34   34 +NODE|
   4    0   34   34 +VAL |
   4    0   34   34 =TEXT|g
   4    1   35   35 -VAL |
   4    1   35   35 -NODE|
   4    1   35   35 =SYNX|:
   4    2   36   36 =WSPC|.
   4    3   37   37 +NODE|
   4    3   37   37 +VAL |
   4    3   37   37 =TEXT|h
   4    4   38   38 -VAL |
   4    4   38   38 -NODE|
   4    4   38   38 =EOL |\x0a
   5    0   39   39 -PAIR|
   5    0   39   39 +PAIR|
   5    0   39   39 +NODE|
   5    0   39   39 +PROP|
   5    0   39   39 +TAG |
   5    0   39   39 +HAND|
   5    0   39   39 =SYNX|!
   5    1   40   40 =SYNX|!
   5    2   41   41 -HAND|
   5    2   41   41 =META|str
   5    5   44   44 -TAG |
   5    5   44   44 -PROP|
   5    5   44   44 =WSPC|.
   5    6   45   45 +VAL |
   5    6   45   45 =TEXT|23
   5    8   47   47 -VAL |
   5    8   47   47 -NODE|
   5    8   47   47 =SYNX|:
   5    9   48   48 =WSPC|.
   5   10   49   49 +NODE|
   5   10   49   49 +PROP|
   5   10   49   49 +TAG |
   5   10   49   49 +HAND|
   5   10   49   49 =SYNX|!
   5   11   50   50 =SYNX|!
   5   12   51   51 -HAND|
   5   12   51   51 =META|bool
   5   16   55   55 -TAG |
   5   16   55   55 -PROP|
   5   16   55   55 =WSPC|.
   5   17   56   56 +VAL |
   5   17   56   56 =TEXT|false
   5   22   61   61 -VAL |
   5   22   61   61 -NODE|
   5   22   61   61 =EOL |\x0a
   6    0   62   62 -PAIR|
   6    0   62   62 -MAP |
   6    0   62   62 -NODE|
   6    0   62   62 -DOC |

perl-pp-perl

 na
{
  '23' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ),
  'a' => 'b',
  'c' => 42,
  'e' => 'f',
  'g' => 'h'
}

perl-pplibyaml-perl

 na
{
  '23' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ),
  'a' => 'b',
  'c' => 42,
  'e' => 'f',
  'g' => 'h'
}

perl-syck-perl

 na
{
  '23' => 'false',
  'a' => 'b',
  'c' => 42,
  'e' => 'f',
  'g' => 'h'
}

perl-yaml-perl

 na
{
  '23' => 'false',
  'a' => 'b',
  'c' => 42,
  'e' => 'f',
  'g' => 'h'
}

py-pyyaml-py

 na
{'23': False, 'a': 'b', 'c': 42, 'e': 'f', 'g': 'h'}

py-ruamel-py

 na
{'23': False, 'a': 'b', 'c': 42, 'e': 'f', 'g': 'h'}

perl-tiny-json

 ni
YAML::Tiny does not support a feature in line '!!int 42' at /yaml/bin/perl-tiny-json line 12.

perl-tiny-perl

 ni
YAML::Tiny does not support a feature in line '!!int 42' at /yaml/bin/perl-tiny-perl line 15.