use strict;
use warnings;
-use Test::More tests => 2 * 25 + 9 + 1;
+use Test::More tests => 2 * 27 + 13 + 1;
use Variable::Magic qw/cast dispell VMG_COMPAT_ARRAY_PUSH_NOLEN VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID VMG_COMPAT_ARRAY_UNDEF_CLEAR/;
check { $a[2] = 'c' } { }, 'assign old element';
-check { $a[3] = 'd' } { set => 1 }, 'assign new element';
+check { $a[4] = 'd' } { set => 1 }, 'assign new element';
+
+$b = check { exists $a[4] } { }, 'exists';
+is $b, 1, 'array: exists correctly';
+
+$b = check { delete $a[4] } { set => 1 }, 'delete';
+is $b, 'd', 'array: delete correctly';
+
+$b = check { @a } { len => 1 }, 'length @';
+is $b, 3, 'array: length @ correctly';
+
+$b = check { $#a } { len => 1 }, 'length $#';
+is $b, 2, 'array: length $# correctly';
check { push @a, 'x'; () }
{ set => 1, (len => 1) x !VMG_COMPAT_ARRAY_PUSH_NOLEN },'push (void)';
+
$b = check { push @a, 'y' }
{ set => 1, (len => 1) x !VMG_COMPAT_ARRAY_PUSH_NOLEN }, 'push (scalar)';
+is $b, 5, 'array: push (scalar) correctly';
$b = check { pop @a } { set => 1, len => 1 }, 'pop';
is $b, 'y', 'array: pop correctly';
'unshift (void)';
$b = check { unshift @a, 't' } { set => 1, len => 1 }, 'unshift (scalar)';
+is $b, 6, 'unshift (scalar) correctly';
$b = check { shift @a } { set => 1, len => 1 }, 'shift';
is $b, 't', 'array: shift correctly';
-$b = check { @a } { len => 1 }, 'length @';
-is $b, 6, 'array: length @ correctly';
-
-$b = check { $#a } { len => 1 }, 'length $#';
-is $b, 5, 'array: length $# correctly';
-
-check { my $i; @a = map ++$i, @a; () } { set => 6, len => 1, clear => 1}, 'map';
+check { my $i; @a = map ++$i, @a; () } { set => 5, len => 1, clear => 1}, 'map';
@b = check { grep { $_ >= 4 } @a } { len => 1 }, 'grep';
-is_deeply \@b, [ 4 .. 6 ], 'array: grep correctly';
+is_deeply \@b, [ 4 .. 5 ], 'array: grep correctly';
-check { 1 for @a } { len => 6 + 1 }, 'for';
+check { 1 for @a } { len => 5 + 1 }, 'for';
check {
my @b = @n;