Delete a duplicated test file and add a new test file for Mouse::PurePerl
[gitmo/Mouse.git] / t / 100_bugs / 014_DEMOLISHALL.t
CommitLineData
4c98ebb0 1#!/usr/bin/env perl
2use strict;
3use warnings;
4use Test::More tests => 5;
5
6my @called;
7
8do {
9 package Class;
10 use Mouse;
11
12 sub DEMOLISH {
13 push @called, 'Class::DEMOLISH';
14 }
15
16 sub DEMOLISHALL {
17 my $self = shift;
18 push @called, 'Class::DEMOLISHALL';
19 $self->SUPER::DEMOLISHALL(@_);
20 }
21
22 package Child;
23 use Mouse;
24 extends 'Class';
25
26 sub DEMOLISH {
27 push @called, 'Child::DEMOLISH';
28 }
29
30 sub DEMOLISHALL {
31 my $self = shift;
32 push @called, 'Child::DEMOLISHALL';
33 $self->SUPER::DEMOLISHALL(@_);
34 }
35};
36
37is_deeply([splice @called], [], "no DEMOLISH calls yet");
38
39do {
40 my $object = Class->new;
41
42 is_deeply([splice @called], [], "no DEMOLISH calls yet");
43};
44
45is_deeply([splice @called], ['Class::DEMOLISHALL', 'Class::DEMOLISH']);
46
47do {
48 my $child = Child->new;
49 is_deeply([splice @called], [], "no DEMOLISH calls yet");
50
51};
52
53is_deeply([splice @called], ['Child::DEMOLISHALL', 'Class::DEMOLISHALL', 'Child::DEMOLISH', 'Class::DEMOLISH']);
54