Skip to content
Browse files

More slurpy type constraint tests.

  • Loading branch information...
1 parent 839a064 commit 6f23c502c61c21c277b3d5087c57badc54df1d49 @rafl committed May 1, 2009
Showing with 15 additions and 1 deletion.
  1. +15 −1 t/list.t
View
16 t/list.t
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use Test::More tests => 13;
+use Test::More tests => 15;
use Test::Exception;
use MooseX::Method::Signatures;
@@ -49,6 +49,20 @@ my $o = bless {} => 'Foo';
}
{
+ my $meth = method (ArrayRef[Int] @foo) {
+ return join q{,}, map { @{ $_ } } @foo;
+ };
+
+ lives_and(sub {
+ is($o->${\$meth->body}([42, 23], [12], [18]), '42,23,12,18');
+ });
+
+ throws_ok(sub {
+ $o->${\$meth->body}([42, 23], 12, [18]);
+ }, qr/Validation failed/);
+}
+
+{
eval 'my $meth = method (:$foo, :@bar) { }';
like $@, qr/arrays or hashes cannot be named/i;

0 comments on commit 6f23c50

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