- Notifications
You must be signed in to change notification settings - Fork 135
/
Copy pathnested_arrays.t
44 lines (34 loc) · 1.18 KB
/
nested_arrays.t
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
41
42
43
44
useTest;
# L<S02/Mutable types/Array>
=begindescription
Nested array tests; various interactions of arrayitems, arrays, flattening and nesting.
=enddescription
plan10;
{ # UNSPECCED
my@a= (1,2,[3,4]);
my$a= (1,2,[3,4]);
my@b= [1,2,[3,4]];
my$b= [1,2,[3,4]];
my@c= (1,2,(3,4));
my$c= (1,2,(3,4));
my@d= [1,2,(3,4)];
my$d= [1,2,(3,4)];
is(+@a, 3, 'Array length, nested []');
is(+$a, 3, 'Array object length, nested []');
is(+@b, 3, 'Array length, nested [], outer []s');
is(+$b, 3, 'Array object length, nested [], outer []s');
is(+@c, 3, 'Array length, nested ()');
is(+$c, 3, 'Array object length, nested ()');
is(+@d, 3, 'Array length, nested (), outer []s');
is(+$d, 3, 'Array object length, nested (), outer []s');
}
# https://github.com/Raku/old-issue-tracker/issues/2471
{
my@a= [1], [2], [3];
my@b=map { @a[1-$_][0] }, 0..3;
isa-ok@b[3], Failure, 'Out of range index returns Failure object';
throws-like'@b[3].sink', X::OutOfRange,
what =>'Index', got =>-2, range =>'0..^Inf',
'Failure object contains X::OutOfRange exception';
}
# vim: expandtab shiftwidth=4