summaryrefslogtreecommitdiff
path: root/ext/arybase/t/akeys.t
blob: 45af13bf475ad6d67643ceb581eab9aac3248d24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use warnings;
use strict;

BEGIN {
	if("$]" < 5.011) {
		require Test::More;
		Test::More::plan(skip_all => "no array keys on this Perl");
	}
}

use Test::More tests => 8;

our @t;

$[ = 3;

@t = ();
is_deeply [ scalar keys @t ], [ 0 ];
is_deeply [ keys @t ], [];

@t = qw(a b c d e f);
is_deeply [ scalar keys @t ], [ 6 ];
is_deeply [ keys @t ], [ 3, 4, 5, 6, 7, 8 ];

SKIP: {
	skip "no lexical \$_", 4 unless eval q{my $_; 1};
	eval q{
		my $_;

		@t = ();
		is_deeply [ scalar keys @t ], [ 0 ];
		is_deeply [ keys @t ], [];

		@t = qw(a b c d e f);
		is_deeply [ scalar keys @t ], [ 6 ];
		is_deeply [ keys @t ], [ 3, 4, 5, 6, 7, 8 ];
	};
}

1;