Regenerate test files
[gitmo/Mouse.git] / t / 020_attributes / 031_delegation_and_modifiers.t
CommitLineData
4060c871 1#!/usr/bin/perl
fde8e43f 2# This is automatically generated by author/import-moose-test.pl.
3# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4use t::lib::MooseCompat;
4060c871 5
6use strict;
7use warnings;
8
fde8e43f 9use Test::More;
4060c871 10use Test::Exception;
11
12{
13 package Bar;
14 use Mouse;
15
16 sub baz { 'Bar::baz' }
17 sub gorch { 'Bar::gorch' }
18
19 package Foo;
20 use Mouse;
21
22 has 'bar' => (
23 is => 'ro',
24 isa => 'Bar',
25 lazy => 1,
26 default => sub { Bar->new },
27 handles => [qw[ baz gorch ]]
28 );
29
30 package Foo::Extended;
31 use Mouse;
32
33 extends 'Foo';
34
35 has 'test' => (
36 is => 'rw',
37 isa => 'Bool',
38 default => sub { 0 },
39 );
40
41 around 'bar' => sub {
42 my $next = shift;
43 my $self = shift;
44
45 $self->test(1);
46 $self->$next();
47 };
48}
49
50my $foo = Foo::Extended->new;
51isa_ok($foo, 'Foo::Extended');
52isa_ok($foo, 'Foo');
53
54ok(!$foo->test, '... the test value has not been changed');
55
56is($foo->baz, 'Bar::baz', '... got the right delegated method');
57
58ok($foo->test, '... the test value has now been changed');
59
fde8e43f 60done_testing;