remove trailing whitespace
[gitmo/Moose.git] / t / 600_todo_tests / 003_immutable_n_around.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 20;
7
8 # if make_immutable is removed from the following code the tests pass
9
10 {
11     package Foo;
12     use Moose;
13
14     has foo => ( is => "ro" );
15
16     package Bar;
17     use Moose;
18
19     extends qw(Foo);
20
21     around new => sub {
22         my $next = shift;
23         my ( $self, @args ) = @_;
24         $self->$next( foo => 42 );
25     };
26
27     package Gorch;
28     use Moose;
29
30     extends qw(Bar);
31
32     package Zoink;
33     use Moose;
34
35     extends qw(Gorch);
36
37 }
38
39 my @classes = qw(Foo Bar Gorch Zoink);
40
41 tests: {
42  TODO: {
43     is( Foo->new->foo, undef, "base class (" . (Foo->meta->is_immutable ? "immutable" : "mutable") . ")" );
44     is( Bar->new->foo, 42, "around new called on Bar->new (" . (Bar->meta->is_immutable ? "immutable" : "mutable") . ")"  );
45     is( Gorch->new->foo, 42, "around new called on Gorch->new (" . (Gorch->meta->is_immutable ? "immutable" : "mutable") . ")"  );
46     is( Zoink->new->foo, 42, "around new called Zoink->new (" . (Zoink->meta->is_immutable ? "immutable" : "mutable") . ")"  );
47     }
48
49     if ( @classes ) {
50         local $SIG{__WARN__} = sub {};
51         ( shift @classes )->meta->make_immutable;
52         redo tests;
53     }
54 }