Revert autogenerated tests. Tests should not changed radically.
[gitmo/Mouse.git] / t / 040_type_constraints / failing / 002_util_type_constraints_export.t
diff --git a/t/040_type_constraints/failing/002_util_type_constraints_export.t b/t/040_type_constraints/failing/002_util_type_constraints_export.t
new file mode 100644 (file)
index 0000000..5d5612c
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 4;
+use Test::Exception;
+
+{
+    package Foo;
+
+    use Mouse::Util::TypeConstraints;
+
+    eval {
+        type MyRef => where { ref($_) };
+    };
+    ::ok( !$@, '... successfully exported &type to Foo package' );
+
+    eval {
+        subtype MyArrayRef => as MyRef => where { ref($_) eq 'ARRAY' };
+    };
+    ::ok( !$@, '... successfully exported &subtype to Foo package' );
+
+    Mouse::Util::TypeConstraints->export_type_constraints_as_functions();
+
+    ::ok( MyRef( {} ), '... Ref worked correctly' );
+    ::ok( MyArrayRef( [] ), '... ArrayRef worked correctly' );
+}