Commit | Line | Data |
---|---|---|
b82b06b8 FC |
1 | use warnings; |
2 | use strict; | |
3 | ||
4 | use Test::More tests => 18; | |
5 | ||
6 | our @t = qw(a b c d e f); | |
7 | our $r = \@t; | |
8 | our @i4 = (3, 5, 3, 5); | |
9 | ||
10 | $[ = 3; | |
11 | ||
12 | is_deeply [ scalar @t[3,4] ], [ qw(b) ]; | |
13 | is_deeply [ @t[3,4,8,9] ], [ qw(a b f), undef ]; | |
14 | is_deeply [ scalar @t[@i4] ], [ qw(c) ]; | |
15 | is_deeply [ @t[@i4] ], [ qw(a c a c) ]; | |
16 | is_deeply [ scalar @{$r}[3,4] ], [ qw(b) ]; | |
17 | is_deeply [ @{$r}[3,4,8,9] ], [ qw(a b f), undef ]; | |
18 | is_deeply [ scalar @{$r}[@i4] ], [ qw(c) ]; | |
19 | is_deeply [ @{$r}[@i4] ], [ qw(a c a c) ]; | |
20 | ||
21 | is_deeply [ @t[2,-1,1,-2] ], [ qw(f f e e) ]; | |
22 | { | |
23 | $[ = -3; | |
24 | is_deeply [@t[-3,()]], ['a']; | |
25 | } | |
26 | ||
27 | SKIP: { | |
28 | skip "no lexical \$_", 8 unless eval q{my $_; 1}; | |
29 | eval q{ | |
30 | my $_; | |
31 | is_deeply [ scalar @t[3,4] ], [ qw(b) ]; | |
32 | is_deeply [ @t[3,4,8,9] ], [ qw(a b f), undef ]; | |
33 | is_deeply [ scalar @t[@i4] ], [ qw(c) ]; | |
34 | is_deeply [ @t[@i4] ], [ qw(a c a c) ]; | |
35 | is_deeply [ scalar @{$r}[3,4] ], [ qw(b) ]; | |
36 | is_deeply [ @{$r}[3,4,8,9] ], [ qw(a b f), undef ]; | |
37 | is_deeply [ scalar @{$r}[@i4] ], [ qw(c) ]; | |
38 | is_deeply [ @{$r}[@i4] ], [ qw(a c a c) ]; | |
39 | }; | |
40 | } | |
41 | ||
42 | 1; |