4 use Test::More tests => 12;
6 my ($class_build, $child_build) = (0, 0);
7 my ($class_buildall, $child_buildall) = (0, 0);
20 $self->SUPER::BUILDALL(@_);
34 $self->SUPER::BUILDALL(@_);
40 is($class_build, 0, "no calls to Class->BUILD");
41 is($child_build, 0, "no calls to Child->BUILD");
43 is($class_buildall, 0, "no calls to Class->BUILDALL");
44 is($child_buildall, 0, "no calls to Child->BUILDALL");
46 my $object = Class->new;
48 is($class_build, 1, "Class->new calls Class->BUILD");
49 is($child_build, 0, "Class->new does not call Child->BUILD");
51 is($class_buildall, 1, "Class->new calls Class->BUILDALL");
52 is($child_buildall, 0, "no calls to Child->BUILDALL");
54 my $child = Child->new;
56 is($child_build, 1, "Child->new calls Child->BUILD");
57 is($class_build, 2, "Child->new also calls Class->BUILD");
59 is($child_buildall, 1, "Child->new calls Child->BUILDALL");
60 is($class_buildall, 2, "Child->BUILDALL calls Class->BUILDALL (but not Child->new)");