File: DEMOLISHALL_shortcutted.t

package info (click to toggle)
libmoose-perl 2.4000-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,408 kB
  • sloc: perl: 21,275; ansic: 291; makefile: 10
file content (35 lines) | stat: -rw-r--r-- 821 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use strict;
use warnings;

## 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;

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' );

done_testing;