[Moose-commits] r7647 - Moose/trunk/t/100_bugs

evancarroll at code2.0beta.co.uk evancarroll at code2.0beta.co.uk
Fri Feb 13 01:49:32 GMT 2009


Author: evancarroll
Date: 2009-02-12 17:49:32 -0800 (Thu, 12 Feb 2009)
New Revision: 7647

Added:
   Moose/trunk/t/100_bugs/021_DEMOLISHALL_shortcutted.t
Log:
This test does some really wiked cool testing stuff. It was confirmed to be a bug because mst was inconsistant with reality.


Added: Moose/trunk/t/100_bugs/021_DEMOLISHALL_shortcutted.t
===================================================================
--- Moose/trunk/t/100_bugs/021_DEMOLISHALL_shortcutted.t	                        (rev 0)
+++ Moose/trunk/t/100_bugs/021_DEMOLISHALL_shortcutted.t	2009-02-13 01:49:32 UTC (rev 7647)
@@ -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 at 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;




More information about the Moose-commits mailing list