BUILDALL and DEMOLISHALL are no longer called by the default constructor/destructor.
[gitmo/Mouse.git] / t / 001_mouse / 014-build.t
index 0d95047..918a7d6 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/env perl
 use strict;
 use warnings;
-use Test::More tests => 3;
+use Test::More tests => 5;
 
 my @called;
 
@@ -13,11 +13,11 @@ do {
         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;
@@ -27,19 +27,31 @@ do {
         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');
+