Changelogging
[gitmo/Mouse.git] / t / 600_todo_tests / 003_immutable_n_around.t
1 #!/usr/bin/perl
2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
5
6 use strict;
7 use warnings;
8
9 use Test::More;
10 $TODO = q{Mouse is not yet completed};
11
12 # if make_immutable is removed from the following code the tests pass
13
14 {
15     package Foo;
16     use Mouse;
17
18     has foo => ( is => "ro" );
19
20     package Bar;
21     use Mouse;
22
23     extends qw(Foo);
24
25     around new => sub {
26         my $next = shift;
27         my ( $self, @args ) = @_;
28         $self->$next( foo => 42 );
29     };
30
31     package Gorch;
32     use Mouse;
33
34     extends qw(Bar);
35
36     package Zoink;
37     use Mouse;
38
39     extends qw(Gorch);
40
41 }
42
43 my @classes = qw(Foo Bar Gorch Zoink);
44
45 tests: {
46  TODO: {
47     is( Foo->new->foo, undef, "base class (" . (Foo->meta->is_immutable ? "immutable" : "mutable") . ")" );
48     is( Bar->new->foo, 42, "around new called on Bar->new (" . (Bar->meta->is_immutable ? "immutable" : "mutable") . ")"  );
49     is( Gorch->new->foo, 42, "around new called on Gorch->new (" . (Gorch->meta->is_immutable ? "immutable" : "mutable") . ")"  );
50     is( Zoink->new->foo, 42, "around new called Zoink->new (" . (Zoink->meta->is_immutable ? "immutable" : "mutable") . ")"  );
51     }
52
53     if ( @classes ) {
54         local $SIG{__WARN__} = sub {};
55         ( shift @classes )->meta->make_immutable;
56         redo tests;
57     }
58 }
59
60 done_testing;