Revert autogenerated tests. Tests should not changed radically.
[gitmo/Mouse.git] / t / 020_attributes / failing / 031_delegation_and_modifiers.t
CommitLineData
4060c871 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
9864f0e4 6use Test::More tests => 5;
4060c871 7use Test::Exception;
8
9{
10 package Bar;
11 use Mouse;
12
13 sub baz { 'Bar::baz' }
14 sub gorch { 'Bar::gorch' }
15
16 package Foo;
17 use Mouse;
18
19 has 'bar' => (
20 is => 'ro',
21 isa => 'Bar',
22 lazy => 1,
23 default => sub { Bar->new },
24 handles => [qw[ baz gorch ]]
25 );
26
27 package Foo::Extended;
28 use Mouse;
29
30 extends 'Foo';
31
32 has 'test' => (
33 is => 'rw',
34 isa => 'Bool',
35 default => sub { 0 },
36 );
37
38 around 'bar' => sub {
39 my $next = shift;
40 my $self = shift;
41
42 $self->test(1);
43 $self->$next();
44 };
45}
46
47my $foo = Foo::Extended->new;
48isa_ok($foo, 'Foo::Extended');
49isa_ok($foo, 'Foo');
50
51ok(!$foo->test, '... the test value has not been changed');
52
53is($foo->baz, 'Bar::baz', '... got the right delegated method');
54
55ok($foo->test, '... the test value has now been changed');
56
9864f0e4 57
58
59
60
61
62
63