oops. i forgot to change make_immutable code.
[gitmo/Mouse.git] / t / 900_bug / 001_immutable_types.t
diff --git a/t/900_bug/001_immutable_types.t b/t/900_bug/001_immutable_types.t
new file mode 100644 (file)
index 0000000..96a82b5
--- /dev/null
@@ -0,0 +1,23 @@
+use strict;
+use warnings;
+use Test::More tests => 2;
+use Mouse::Util::TypeConstraints;
+
+subtype 'Foo', where => sub { $_->isa('A') };
+
+{
+    package A;
+    use Mouse;
+    has data => ( is => 'rw', isa => 'Str' );
+}
+
+{
+    package B;
+    use Mouse;
+    has a => ( is => 'rw', isa => 'Foo', coerce => 1 );
+}
+
+isa_ok(B->new(a => A->new()), 'B');
+B->meta->make_immutable;
+isa_ok(B->new(a => A->new()), 'B');
+