added test case for immutable destroy overriding.
Dylan William Hardison [Thu, 11 Jun 2009 14:34:47 +0000 (14:34 +0000)]
t/310_immutable_destroy.t [new file with mode: 0644]

diff --git a/t/310_immutable_destroy.t b/t/310_immutable_destroy.t
new file mode 100644 (file)
index 0000000..774ded0
--- /dev/null
@@ -0,0 +1,30 @@
+use strict;
+use warnings;
+use Test::More tests => 1;
+use Class::MOP;
+
+BEGIN {
+       package FooBar;
+       sub DESTROY { shift->name }
+}
+
+{
+       my $meta = Class::MOP::Class->initialize('FooBar');
+       $meta->add_attribute(
+               Class::MOP::Attribute->new(
+                       'name' => (
+                               reader => 'name',
+                       )
+               )
+       );
+
+    $meta->make_immutable(
+               inline_accessors => 1,
+               inline_constructor => 1,
+               inline_destructor => 1,
+       );
+}
+
+my $f = FooBar->new( name => 'SUSAN' );
+
+is( $f->DESTROY, 'SUSAN', 'Did class-mop overload DESTROY?' );