From: Evan Carroll Date: Fri, 13 Feb 2009 01:49:32 +0000 (+0000) Subject: This test does some really wiked cool testing stuff. It was confirmed to be a bug... X-Git-Tag: 0.70~30 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=106bf37c548dab3be28ba611d7ca1ec49f3e17c5;p=gitmo%2FMoose.git This test does some really wiked cool testing stuff. It was confirmed to be a bug because mst was inconsistant with reality. --- diff --git a/t/100_bugs/021_DEMOLISHALL_shortcutted.t b/t/100_bugs/021_DEMOLISHALL_shortcutted.t new file mode 100644 index 0000000..531ae09 --- /dev/null +++ b/t/100_bugs/021_DEMOLISHALL_shortcutted.t @@ -0,0 +1,32 @@ +## This test ensures that sub DEMOLISHALL fires even if there is no sub DEMOLISH +## Currently fails because of a bad optimization in DESTROY +## Feb 12, 2009 -- Evan Carroll me@evancarroll.com +package Role::DemolishAll; +use Moose::Role; +our $ok = 0; + +sub BUILD { $ok = 0 }; +after 'DEMOLISHALL' => sub { $Role::DemolishAll::ok++ }; + +package DemolishAll::WithoutDemolish; +use Moose; +with 'Role::DemolishAll'; + +package DemolishAll::WithDemolish; +use Moose; +with 'Role::DemolishAll'; +sub DEMOLISH {}; + + +package main; +use Test::More tests => 2; + +my $m = DemolishAll::WithDemolish->new; +undef $m; +is ( $Role::DemolishAll::ok, 1, 'DemolishAll w/ explicit DEMOLISH sub' ); + +$m = DemolishAll::WithoutDemolish->new; +undef $m; +is ( $Role::DemolishAll::ok, 1, 'DemolishAll wo/ explicit DEMOLISH sub' ); + +1;