4 use Test::More tests => 10;
13 push @called, 'Class::DEMOLISH';
18 # push @called, 'Class::DEMOLISHALL';
19 # $self->SUPER::DEMOLISHALL(@_);
27 push @called, 'Child::DEMOLISH';
32 # push @called, 'Child::DEMOLISHALL';
33 # $self->SUPER::DEMOLISHALL(@_);
37 is_deeply([splice @called], [], "no DEMOLISH calls yet");
40 my $object = Class->new;
42 is_deeply([splice @called], [], "no DEMOLISH calls yet");
45 is_deeply([splice @called], ['Class::DEMOLISH']);
48 my $child = Child->new;
49 is_deeply([splice @called], [], "no DEMOLISH calls yet");
53 is_deeply([splice @called], ['Child::DEMOLISH', 'Class::DEMOLISH']);
55 Class->meta->make_immutable();
56 Child->meta->make_immutable();
58 is_deeply([splice @called], [], "no DEMOLISH calls yet");
61 my $object = Class->new;
63 is_deeply([splice @called], [], "no DEMOLISH calls yet");
66 is_deeply([splice @called], ['Class::DEMOLISH'], 'after make_immutable');
69 my $child = Child->new;
70 is_deeply([splice @called], [], "no DEMOLISH calls yet");
74 is_deeply([splice @called], ['Child::DEMOLISH', 'Class::DEMOLISH'], 'after make_immutable');