1
1
use v6 ;
2
2
use Test ;
3
- plan 25 ;
3
+ plan 26 ;
4
4
5
5
# L<S09/Fixed-size arrays>
6
6
@@ -11,26 +11,26 @@ plan 25;
11
11
is (+ @ arr , 43 , ' my @arr[*] autoextends like my @arr' );
12
12
}
13
13
14
- # ?rakudo skip 'array shapes NYI RT #124502'
15
14
{
16
15
my @ arr [7 ] = <a b c d e f g >;
17
16
is (@ arr , [<a b c d e f g >], ' my @arr[num] can hold num things' );
18
- throws-like {push @ arr , ' h' },
19
- Exception , # XXX fix when this block is no longer skipped
17
+ throws-like q [ push @arr, 'h' ] ,
18
+ X::IllegalOnFixedDimensionArray ,
19
+ operation => ' push' ,
20
20
' adding past num items in my @arr[num] dies' ;
21
- throws-like { @ arr [7 ]} ,
22
- Exception , # XXX fix when this block is no longer skipped
21
+ throws-like ' @arr[7]' ,
22
+ Exception ,
23
23
' accessing past num items in my @arr[num] dies' ;
24
24
}
25
25
26
- # ?rakudo skip 'array shapes NYI RT #124502'
27
26
{
28
- lives-ok { my @ arr \ [7 ]},
29
- ' array with fixed size with unspace' );
30
- throws-like { EVAL ' my @arr.[8]' },
27
+ lives-ok { my @ arr \ [7 ] },
28
+ ' array with fixed size with unspace' ;
29
+ # ?rakudo 2 todo 'code does not die, array shapes RT #124502'
30
+ throws-like ' my @arr.[8]' ,
31
31
Exception , # XXX fix when this block is no longer skipped
32
32
' array with dot form dies' ;
33
- throws-like { EVAL ' my @arr\ .[8]' } ,
33
+ throws-like ' my @arr\ .[8]' ,
34
34
Exception , # XXX fix when this block is no longer skipped
35
35
' array with dot form and unspace dies' ;
36
36
}
@@ -39,38 +39,38 @@ plan 25;
39
39
{
40
40
my @ arr of Int = 1 , 2 , 3 , 4 , 5 ;
41
41
is (@ arr , <1 2 3 4 5 >, ' my @arr of Type works' );
42
- throws-like { push @ arr , ' s' } ,
42
+ throws-like q [ push @arr, 's' ] ,
43
43
X::TypeCheck ,
44
44
' type constraints on my @arr of Type works (1)' ;
45
- throws-like { push @ arr , 4.2 } ,
45
+ throws-like ' push @arr, 4.2' ,
46
46
X::TypeCheck ,
47
47
' type constraints on my @arr of Type works (2)' ;
48
48
}
49
49
{
50
50
my Int @ arr = 1 , 2 , 3 , 4 , 5 ;
51
51
is (@ arr , <1 2 3 4 5 >, ' my Type @arr works' );
52
- throws-like { push @ arr , ' s' } ,
52
+ throws-like q [ push @arr, 's' ] ,
53
53
X::TypeCheck ,
54
54
' type constraints on my Type @arr works (1)' ;
55
- throws-like { push @ arr , 4.2 } ,
55
+ throws-like ' push @arr, 4.2' ,
56
56
X::TypeCheck ,
57
57
' type constraints on my Type @arr works (2)' ;
58
58
}
59
59
60
- # ?rakudo skip 'array shapes NYI RT #124502'
61
60
{
62
61
my @ arr [5 ] of Int = <1 2 3 4 5 >;
63
62
is (@ arr , <1 2 3 4 5 >, ' my @arr[num] of Type works' );
64
63
65
- throws-like {push @ arr , 123 },
64
+ # ?rakudo todo 'code does not die, array shapes RT #124502'
65
+ throws-like ' push @arr, 123' ,
66
66
Exception ,
67
67
' boundary constraints on my @arr[num] of Type works' ;
68
68
pop @ arr ; # remove the last item to ensure the next ones are type constraints
69
- throws-like { push @ arr , ' s' } ,
70
- Exception ,
69
+ throws-like q [ push @arr, 's' ] ,
70
+ X::TypeCheck ,
71
71
' type constraints on my @arr[num] of Type works (1)' ;
72
- throws-like { push @ arr , 4.2 } ,
73
- Exception ,
72
+ throws-like ' push @arr, 4.2' ,
73
+ X::TypeCheck ,
74
74
' type constraints on my @arr[num] of Type works (2)' ;
75
75
}
76
76
@@ -79,27 +79,28 @@ plan 25;
79
79
is (@ arr , <1 2 3 4 5 >, ' my type @arr works' );
80
80
is push (@ arr , 6 ), [1 ,2 ,3 ,4 ,5 ,6 ], ' push on native @arr works' ;
81
81
# RT #125123'
82
- throws-like { EVAL ' push @arr, "s"' } ,
82
+ throws-like ' push @arr, "s"' ,
83
83
X::TypeCheck ,
84
84
' type constraints on my type @arr works (1)' ;
85
- throws-like { EVAL ' push @arr, 4.2' } ,
85
+ throws-like ' push @arr, 4.2' ,
86
86
X::TypeCheck ,
87
87
' type constraints on my type @arr works (2)' ;
88
88
}
89
89
90
- # ?rakudo skip 'array shapes NYI RT #124502'
91
90
{
92
91
my int @ arr [5 ] = <1 2 3 4 5 >;
93
92
is (@ arr , <1 2 3 4 5 >, ' my Type @arr[num] works' );
94
93
95
- throws-like {push @ arr , 123 },
96
- Exception ,
97
- ' boundary constraints on my Type @arr[num] works' ;
98
- pop @ arr ; # remove the last item to ensure the next ones are type constraints
99
- throws-like {push @ arr , ' s' },
100
- Exception , # XXX fix when this block is no longer skipped
101
- ' type constraints on my Type @arr[num] works (1)' ;
102
- throws-like {push @ arr , 4.2 },
103
- Exception , # XXX fix when this block is no longer skipped
104
- ' type constraints on my Type @arr[num] works (2)' ;
94
+ throws-like ' push @arr, 123' ,
95
+ X::IllegalOnFixedDimensionArray ,
96
+ operation => ' push' ;
97
+ throws-like ' pop @arr' ,
98
+ X::IllegalOnFixedDimensionArray ,
99
+ operation => ' pop' ;
100
+ throws-like q [ push @arr, 's' ] ,
101
+ X::IllegalOnFixedDimensionArray ,
102
+ operation => ' push' ;
103
+ throws-like ' push @arr, 4.2' ,
104
+ X::IllegalOnFixedDimensionArray ,
105
+ operation => ' push' ;
105
106
}
0 commit comments