Skip to content
Browse files

use throws_like instead of ad-hoc DIY solution.

  • Loading branch information...
1 parent f4ba686 commit 741266bafd270f696e8754a4f21b39a3b2dfa937 @timo timo committed Dec 18, 2012
Showing with 5 additions and 13 deletions.
  1. +5 −13 S02-types/array.t
View
18 S02-types/array.t
@@ -1,8 +1,10 @@
use v6;
use Test;
+BEGIN { @*INC.push('t/spec/packages/') };
+use Test::Util;
-plan 97;
+plan 99;
#L<S02/Mutable types/Array>
@@ -336,21 +338,11 @@ my @array2 = ("test", 1, Mu);
}
{
- 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';
+ throws_like 'my @a = 1..*; @a[Inf] = "dog"', X::Item, index => Inf, aggregate => 1..*;
}
{
- 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;
+ throws_like 'my @a = 1..*; @a[NaN] = "cat"', X::Item, index => NaN, aggregate => 1..*;
}
done;

0 comments on commit 741266b

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