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