File: kvaslice.t

package info (click to toggle)
libarray-base-perl 0.006-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 168 kB
  • sloc: perl: 13; makefile: 3
file content (31 lines) | stat: -rw-r--r-- 714 bytes parent folder | download | duplicates (3)
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
use warnings;
use strict;

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

use Test::More tests => 8;

our @t = qw(a b c d e f);
our $r = \@t;
our @i4 = (3, 5, 3, 5);

use Array::Base +3;

no warnings "syntax";

is_deeply [ scalar %t[3,4] ], [ "b" ];
is_deeply [ %t[3,4,8,9] ], [ 3, "a", 4, "b", 8, "f", 9, undef ];
is_deeply [ scalar %t[@i4] ], [ "c" ];
is_deeply [ %t[@i4] ], [ 3, "a", 5, "c", 3, "a", 5, "c" ];
is_deeply [ scalar %{$r}[3,4] ], [ "b" ];
is_deeply [ %{$r}[3,4,8,9] ], [ 3, "a", 4, "b", 8, "f", 9, undef ];
is_deeply [ scalar %{$r}[@i4] ], [ "c" ];
is_deeply [ %{$r}[@i4] ], [ 3, "a", 5, "c", 3, "a", 5, "c" ];

1;