X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F31-array.t;h=2fee830a2f29395f38c58c6548754d9650e6970c;hb=fee1a480bc5d827590dc7394e0a77741bad86dc3;hp=62f41456e6103af03504cf15f9b0267f2c8030c4;hpb=ad7c749baf8ebc2ff3e49d44b414f67f13f4ebf2;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/t/31-array.t b/t/31-array.t index 62f4145..2fee830 100644 --- a/t/31-array.t +++ b/t/31-array.t @@ -1,14 +1,17 @@ #!perl -T +use strict; +use warnings; + use Test::More tests => 21; -use Variable::Magic qw/wizard cast dispell/; +use Variable::Magic qw/wizard cast dispell VMG_COMPAT_ARRAY_PUSH_NOLEN VMG_COMPAT_ARRAY_UNDEF_CLEAR/; -my @c = (0) x 5; -my @x = (0) x 5; +my @c = (0) x 12; +my @x = (0) x 12; sub check { - for (0 .. 4) { return 0 unless $c[$_] == $x[$_]; } + for (0 .. 11) { return 0 unless $c[$_] == $x[$_]; } return 1; } @@ -16,7 +19,14 @@ my $wiz = wizard get => sub { ++$c[0] }, set => sub { ++$c[1] }, len => sub { ++$c[2]; $_[2] }, clear => sub { ++$c[3] }, - free => sub { ++$c[4] }; + free => sub { ++$c[4] }, + copy => sub { ++$c[5] }, + dup => sub { ++$c[6] }, + local => sub { ++$c[7] }, + fetch => sub { ++$c[8] }, + store => sub { ++$c[9] }, + 'exists' => sub { ++$c[10] }, + 'delete' => sub { ++$c[11] }; ok(check(), 'array : create wizard'); my @n = map { int rand 1000 } 1 .. 5; @@ -54,7 +64,7 @@ $a[3] = 'd'; ok(check(), 'array : assign new element'); push @a, 'x'; -++$x[1]; ++$x[2] unless $^V && $^V gt 5.9.2; # since 5.9.3 +++$x[1]; ++$x[2] unless VMG_COMPAT_ARRAY_PUSH_NOLEN; ok(check(), 'array : push'); pop @a; @@ -93,7 +103,7 @@ ok(check(), 'array : for'); ok(check(), 'array : scope end'); undef @a; -++$x[3] if $^V && $^V gt 5.9.4; # since 5.9.5 - see #43357 +++$x[3] if VMG_COMPAT_ARRAY_UNDEF_CLEAR; ok(check(), 'array : undef'); dispell @a, $wiz;