Skip to content
Browse files

test for @a[Inf] and @a[NaN] -> X::Item.

  • Loading branch information...
1 parent c50e4ea commit f4ba686569f85b28ca532a1994ff771fb193fc5c @timo timo committed Dec 18, 2012
Showing with 19 additions and 1 deletion.
  1. +19 −1 S02-types/array.t
View
20 S02-types/array.t
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 91;
+plan 97;
#L<S02/Mutable types/Array>
@@ -335,6 +335,24 @@ my @array2 = ("test", 1, Mu);
ok Array(1,2,3) eqv [1,2,3], 'Array(1,2,3) makes correct array';
}
+{
+ my @a = 1..*;
+ try { @a[Inf] = "dog"; }
+ my $err = $!;
+ ok $err ~~ X::Item, '@a[Inf] throws X::Item';
+ is $err.index, Inf, 'X::Item.index is correct';
+ is $err.aggregate, @a, 'X::Item.aggregate is the array that could not be indexed';
+}
+
+{
+ my @a = 1..*;
+ try { @a[NaN] = "dog"; }
+ my $err = $!;
+ ok $err ~~ X::Item, '@a[NaN] throws X::Item';
+ is $err.index, NaN;
+ is $err.aggregate, @a;
+}
+
done;
# vim: ft=perl6

0 comments on commit f4ba686

Please sign in to comment.
Something went wrong with that request. Please try again.