Browse files

make sure Array[Type].new(NonType) dies with X::TypeCheck

  • Loading branch information...
1 parent 6a456ab commit 4e793d06e3000bafad7ef49468dc9494e6a5a2f1 @timo timo committed Oct 5, 2013
Showing with 9 additions and 2 deletions.
  1. +0 −1 S02-lexical-conventions/unspace.t
  2. +9 −1 S32-array/create.t
View
1 S02-lexical-conventions/unspace.t
@@ -278,7 +278,6 @@ eval_dies_ok('sub f { 3 } sub g { 3 }', 'semicolon or newline required between b
# L<S02/"Bracketing Characters"/"U+301D codepoint has two closing alternatives">
#?niecza skip 'Unable to resolve method id in class Str'
- #?rakudo skip 'unspace + dotty postfix'
is((foo\#`〝 comment 〞.id), 'a', 'unspace with U+301D/U+301E comment');
eval_dies_ok('foo\#`〝 comment 〟.id', 'unspace with U+301D/U+301F is invalid');
View
10 S32-array/create.t
@@ -9,12 +9,20 @@ built-in "Array" tests
=end pod
-plan 3;
+plan 6;
my $array_obj = Array.new(4, 5, 6);
is($array_obj.WHAT.gist, Array.gist, 'Creating a new list object with new works.');
is($array_obj, list(4, 5, 6), 'The list object contains the right values.');
is(+$array_obj, 3, 'Finding the length functions properly.');
+{
+ use lib "t/spec/packages";
+ use Test::Util;
+ ok +Array[Int].new(1, 2, 3, 4), "typed array";
+ throws_like(q{ Array[Int].new(1, 2, "Foo") }, X::TypeCheck);
+ throws_like(q{ Array[Str].new(1, 2, "Foo") }, X::TypeCheck);
+}
+
# vim: ft=perl6

0 comments on commit 4e793d0

Please sign in to comment.