Changelogging
[gitmo/Mouse.git] / t / 100_bugs / 021_DEMOLISHALL_shortcutted.t
1 ## This test ensures that sub DEMOLISHALL fires even if there is no sub DEMOLISH
2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
5 ## Currently fails because of a bad optimization in DESTROY
6 ## Feb 12, 2009 -- Evan Carroll me@evancarroll.com
7 package Role::DemolishAll;
8 use Mouse::Role;
9 our $ok = 0;
10
11 sub BUILD { $ok = 0 };
12 after 'DEMOLISHALL' => sub { $Role::DemolishAll::ok++ };
13
14 package DemolishAll::WithoutDemolish;
15 use Mouse;
16 with 'Role::DemolishAll';
17
18 package DemolishAll::WithDemolish;
19 use Mouse;
20 with 'Role::DemolishAll';
21 sub DEMOLISH {};
22
23
24 package main;
25 use Test::More;
26 $TODO = q{Mouse is not yet completed};
27
28 my $m = DemolishAll::WithDemolish->new;
29 undef $m;
30 is ( $Role::DemolishAll::ok, 1, 'DemolishAll w/ explicit DEMOLISH sub' );
31
32 $m = DemolishAll::WithoutDemolish->new;
33 undef $m;
34 is ( $Role::DemolishAll::ok, 1, 'DemolishAll wo/ explicit DEMOLISH sub' );
35
36 done_testing;