Skip Alien-Ditaa
[gitmo/Moose.git] / t / bugs / instance_application_role_args.t
CommitLineData
f315aab3 1#!/usr/bin/perl
2use strict;
3use warnings;
4use Test::More;
f315aab3 5
6{
7 package Point;
8 use Moose;
9
10 with qw/DoesNegated DoesTranspose/;
11
12 has x => ( isa => 'Int', is => 'rw' );
13 has y => ( isa => 'Int', is => 'rw' );
14
15 sub inspect { [$_[0]->x, $_[0]->y] }
16
17 no Moose;
18}
19
20{
21 package DoesNegated;
22 use Moose::Role;
23
24 sub negated {
25 my $self = shift;
26 $self->new( x => -$self->x, y => -$self->y );
27 }
28
29 no Moose::Role;
30}
31
32{
33 package DoesTranspose;
34 use Moose::Role;
35
36 sub transpose {
37 my $self = shift;
38 $self->new( x => $self->y, y => $self->x );
39 }
40
41 no Moose::Role;
42}
43
44my $p = Point->new( x => 4, y => 3 );
45
82f8ace6 46DoesTranspose->meta->apply( $p, -alias => { transpose => 'negated' } );
f315aab3 47
48is_deeply($p->negated->inspect, [3, 4]);
49is_deeply($p->transpose->inspect, [3, 4]);
50
51done_testing;