]> git.vpit.fr Git - perl/modules/Test-Leaner.git/blobdiff - t/26-is_deeply.t
Prevent vivification of deleted elements by fetching the array values
[perl/modules/Test-Leaner.git] / t / 26-is_deeply.t
index 0d6b84c9e565f28b5db11dab390ce908f9c0c742..d4550409f41cb36e6be0b74c411a00f4b4291c0f 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::Leaner tests => 21 + 2 + 1;
+use Test::Leaner tests => 21 + 2 + 1 + 2;
 
 my $lacunary = [ [ 1, 2, 3 ] => [ 1, 2, 3 ] ];
 delete $lacunary->[0]->[1];
@@ -100,3 +100,13 @@ push @tests, [ map Test::Leaner::TestIsDeeplyOverload->new('foo'), 1 .. 2 ];
 for my $t (@tests) {
  is_deeply $t->[0], $t->[1];
 }
+
+# Test vivification of deleted elements of an array
+
+{
+ my @l = (1);
+ $l[2] = 3;
+ is_deeply \@l, [ 1, undef, 3 ];
+ delete $l[2];
+ is_deeply \@l, [ 1 ];
+}