Server : Apache System : Linux dedi-14684855.grupobig.com 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64 User : grupo692 ( 1004) PHP Version : 8.2.31 Disable Function : NONE Directory : /home/.cpan/build/YAML-LibYAML-v0.902.0-0/t/ |
use FindBin '$Bin';
use lib $Bin;
use TestYAMLTests tests => 5;
my $array = [
undef,
'undef',
33,
'~',
undef,
undef,
'~/file.txt',
];
undef $array->[2];
my $yaml = Dump($array);
is $yaml, <<'...', "Nulls dump as ~";
---
- ~
- undef
- ~
- '~'
- ~
- ~
- ~/file.txt
...
my $array2 = Load($yaml);
is_deeply $array2, $array,
"YAML with undefs loads properly";
$yaml = "{foo, bar}\n";
my $perl = {foo => undef, bar => undef};
is_deeply Load($yaml), $perl,
"Set notation has null values";
$yaml = <<'...';
---
foo:
bar:
-
- -
gorch: null
...
$perl = {foo => undef, bar => [undef, [undef]], gorch => undef};
is_deeply Load($yaml), $perl,
"Empty values Load as undefs";
$yaml = <<'...';
---
- -
- -
...
$perl = [[undef], [undef]];
is_deeply Load($yaml), $perl,
"Can Load 'dash art'";