Commit | Line | Data |
7a59f4e8 |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Test::More 'no_plan'; |
7 | |
8 | { |
9 | package Foo; |
10 | use Mouse; |
11 | |
12 | has foo => ( |
13 | isa => "Str", |
14 | is => "rw", |
15 | default => "foo", |
16 | ); |
17 | |
18 | has bar => ( |
19 | isa => "ArrayRef", |
20 | is => "rw", |
21 | ); |
22 | |
23 | sub clone { |
24 | my ( $self, @args ) = @_; |
25 | $self->meta->clone_object( $self, @args ); |
26 | } |
27 | } |
28 | |
29 | my $foo = Foo->new( bar => [ 1, 2, 3 ] ); |
30 | |
31 | is( $foo->foo, "foo", "attr 1", ); |
32 | is_deeply( $foo->bar, [ 1 .. 3 ], "attr 2" ); |
33 | |
34 | my $clone = $foo->clone( foo => "dancing" ); |
35 | |
36 | is( $clone->foo, "dancing", "overridden attr" ); |
37 | is_deeply( $clone->bar, [ 1 .. 3 ], "clone attr" ); |
38 | |