update foreign tests
[p5sagit/Function-Parameters.git] / t / foreign / MooseX-Method-Signatures / type_alias.t
diff --git a/t/foreign/MooseX-Method-Signatures/type_alias.t b/t/foreign/MooseX-Method-Signatures/type_alias.t
new file mode 100644 (file)
index 0000000..21b8cac
--- /dev/null
@@ -0,0 +1,31 @@
+#!perl
+use strict;
+use warnings FATAL => 'all';
+use Test::More
+    eval { require Moose; require aliased }
+    ? (tests => 2)
+    : (skip_all => "Moose, aliased required for testing types")
+;
+use Test::Fatal;
+
+use Dir::Self;
+use lib __DIR__ . '/lib';
+
+{
+    package TestClass;
+    use Moose;
+    use Function::Parameters qw(:strict);
+
+    use aliased 'My::Annoyingly::Long::Name::Space', 'Shortcut';
+
+    ::is(::exception { method alias_sig ((Shortcut) $affe) { } },
+        undef, 'method with aliased type constraint compiles');
+}
+
+my $o = TestClass->new;
+my $affe = My::Annoyingly::Long::Name::Space->new;
+
+is(exception {
+    $o->alias_sig($affe);
+}, undef, 'calling method with aliased type constraint');
+