This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Brendan Byrd is now a perl AUTHOR
[perl5.git] / ext / arybase / t / aelem.t
CommitLineData
36b2db7e 1use warnings; no warnings 'deprecated';
b82b06b8
FC
2use strict;
3
4use Test::More tests => 33;
5
6our @t = qw(a b c d e f);
7our $r = \@t;
8our($i3, $i4, $i8, $i9) = (3, 4, 8, 9);
9our @i4 = (3, 3, 3, 3);
10
11$[ = 3;
12
13is $t[3], "a";
14is $t[4], "b";
15is $t[8], "f";
16is $t[9], undef;
17is_deeply [ scalar $t[4] ], [ "b" ];
18is_deeply [ $t[4] ], [ "b" ];
19
20is $t[2], 'f';
21is $t[-1], 'f';
22is $t[1], 'e';
23is $t[-2], 'e';
24
25{
26 $[ = -3;
27 is $t[-3], 'a';
28}
29
30is $r->[3], "a";
31is $r->[4], "b";
32is $r->[8], "f";
33is $r->[9], undef;
34is_deeply [ scalar $r->[4] ], [ "b" ];
35is_deeply [ $r->[4] ], [ "b" ];
36
37is $t[$i3], "a";
38is $t[$i4], "b";
39is $t[$i8], "f";
40is $t[$i9], undef;
41is_deeply [ scalar $t[$i4] ], [ "b" ];
42is_deeply [ $t[$i4] ], [ "b" ];
43is_deeply [ scalar $t[@i4] ], [ "b" ];
44is_deeply [ $t[@i4] ], [ "b" ];
45
46is $r->[$i3], "a";
47is $r->[$i4], "b";
48is $r->[$i8], "f";
49is $r->[$i9], undef;
50is_deeply [ scalar $r->[$i4] ], [ "b" ];
51is_deeply [ $r->[$i4] ], [ "b" ];
52is_deeply [ scalar $r->[@i4] ], [ "b" ];
53is_deeply [ $r->[@i4] ], [ "b" ];
54
55
561;