Resolve several failing tests
[gitmo/Mouse.git] / t / 040_type_constraints / 029_define_type_twice_throws.t
diff --git a/t/040_type_constraints/029_define_type_twice_throws.t b/t/040_type_constraints/029_define_type_twice_throws.t
new file mode 100644 (file)
index 0000000..67bc3ae
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 2;
+use Test::Exception;
+
+BEGIN {
+    use_ok('Mouse::Util::TypeConstraints');
+}
+
+{
+    package Some::Class;
+    use Mouse::Util::TypeConstraints;
+
+    subtype 'MySubType' => as 'Int' => where { 1 };
+}
+
+throws_ok {
+    package Some::Other::Class;
+    use Mouse::Util::TypeConstraints;
+
+    subtype 'MySubType' => as 'Int' => where { 1 };
+} qr/cannot be created again/, 'Trying to create same type twice throws';
+