#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More tests => 5;
my @called;
push @called, 'Class::BUILD';
}
- sub BUILDALL {
- my $self = shift;
- push @called, 'Class::BUILDALL';
- $self->SUPER::BUILDALL(@_);
- }
+# sub BUILDALL {
+# my $self = shift;
+# push @called, 'Class::BUILDALL';
+# $self->SUPER::BUILDALL(@_);
+# }
package Child;
use Mouse;
push @called, 'Child::BUILD';
}
- sub BUILDALL {
- my $self = shift;
- push @called, 'Child::BUILDALL';
- $self->SUPER::BUILDALL(@_);
- }
+# sub BUILDALL {
+# my $self = shift;
+# push @called, 'Child::BUILDALL';
+# $self->SUPER::BUILDALL(@_);
+# }
};
is_deeply([splice @called], [], "no BUILD calls yet");
my $object = Class->new;
-is_deeply([splice @called], ["Class::BUILDALL", "Class::BUILD"]);
+is_deeply([splice @called], ["Class::BUILD"]);
my $child = Child->new;
-is_deeply([splice @called], ["Child::BUILDALL", "Class::BUILDALL", "Class::BUILD", "Child::BUILD"]);
+is_deeply([splice @called], ["Class::BUILD", "Child::BUILD"]);
+
+Class->meta->make_immutable;
+Child->meta->make_immutable;
+
+$object = Class->new;
+
+is_deeply([splice @called], ["Class::BUILD"], 'after make_immutable');
+
+$child = Child->new;
+
+is_deeply([splice @called], ["Class::BUILD", "Child::BUILD"], 'after make_immutable');
+