Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Track improved error message from array[int].push and .unishift
  • Loading branch information
moritz committed Nov 14, 2015
1 parent 94099c8 commit 49d4301
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions S09-typed-arrays/native-int.t
Expand Up @@ -133,8 +133,9 @@ for flat @int,@uint -> $T {
is @arr.push(42), (42,), "can push to $t array";
is @arr.elems, 1, "push to $t array works (1)";
is @arr[0], 42, "push to $t array works (2)";
throws-like { @arr.push('it real good') }, Exception,
message => 'This type cannot unbox to a native integer',
# RT #125123
throws-like { @arr.push('it real good') }, X::TypeCheck,
got => Str,
"Cannot push non-int/Int to $t array";
throws-like { @arr[0] := my $a }, Exception,
message => 'Cannot bind to a natively typed array',
Expand All @@ -158,8 +159,9 @@ for flat @int,@uint -> $T {
is @arr.elems, 3, "unshift to $t array works (1)";
is @arr[0], 1, "unshift to $t array works (2)";
is @arr[1], 42, "unshift to $t array works (3)";
throws-like { @arr.unshift('part of the day not working') }, Exception,
message => 'This type cannot unbox to a native integer',
# RT #125123
throws-like { @arr.unshift('part of the day not working') }, X::TypeCheck,
got => Str,
"Cannot unshift non-int/Int to $t array";

is (@arr.unshift(3,2)), (3,2,1,42,101),"can unshift multiple to $t array";
Expand Down

0 comments on commit 49d4301

Please sign in to comment.