Skip to content

Commit 071720b

Browse files
committed
add tests for RT #126291
1 parent de0ce3a commit 071720b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

S04-declarations/smiley.t

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use v6;
22
use Test;
33

4-
plan 57;
4+
plan 60;
55

66
my Int:D $j = 256;
77
MY::<$j> = 111;
@@ -142,4 +142,17 @@ throws-like 'use variables :foo',
142142
name => 'foo',
143143
'does use variables :foo fail';
144144

145+
# RT #126291
146+
{
147+
my Int:D $x is default(0);
148+
is $x, 0, 'Int:D with default value via trait';
149+
150+
my Int:D @array is default(0); @array[0] = Nil;
151+
is @array[0], 0, 'Int:D array with default value via trait';
152+
153+
throws-like { @array[0] = Int },
154+
X::TypeCheck::Assignment,
155+
symbol => '@array', 'type check happens for Int:D array';
156+
}
157+
145158
# vim: ft=perl6

0 commit comments

Comments
 (0)