Skip to content
Browse files

Add failing coercion tests.

  • Loading branch information...
1 parent 2c5e580 commit 570fa24bb5a43d79430e5045e2ec9ab2c7ff24db @rafl committed
Showing with 30 additions and 0 deletions.
  1. +30 −0 t/coerce.t
View
30 t/coerce.t
@@ -0,0 +1,30 @@
+use strict;
+use warnings;
+use Test::More;
+
+BEGIN {
+ eval 'use MooseX::Types::Path::Class';
+ plan skip_all => 'MooseX::Types::Path::Class required for this test' if $@;
+}
+
+{
+ package Foo;
+ use Moose;
+ use MooseX::Method::Signatures;
+ use MooseX::Types::Path::Class qw/Dir/;
+
+ method foo (Dir $dir does coerce) { $dir }
+ method bar (Dir :$dir does coerce) { $dir }
+ method baz (Dir :$dir! does coerce) { $dir }
+
+ warn Foo->meta->get_method('bar')->type_constraint->_type_constraint;
+}
+
+{
+ my $foo = Foo->new;
+ isa_ok($foo->foo('.'), 'Path::Class::Dir');
+ isa_ok($foo->bar(dir => '.'), 'Path::Class::Dir');
+ isa_ok($foo->baz(dir => '.'), 'Path::Class::Dir');
+}
+
+done_testing;

0 comments on commit 570fa24

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