From: Dylan William Hardison Date: Thu, 11 Jun 2009 14:34:47 +0000 (+0000) Subject: added test case for immutable destroy overriding. X-Git-Tag: 0.86~21 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1a3857b9985b229f3ce49ea65084830c0cbb87f6;p=gitmo%2FClass-MOP.git added test case for immutable destroy overriding. --- diff --git a/t/310_immutable_destroy.t b/t/310_immutable_destroy.t new file mode 100644 index 0000000..774ded0 --- /dev/null +++ b/t/310_immutable_destroy.t @@ -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?' );