X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F100_bugs%2F029_instance_application_role_args.t;fp=t%2F100_bugs%2F029_instance_application_role_args.t;h=c1f431b1ee0eb9841a391392900acb9f5dfe60e4;hb=fde8e43f95fe996fbc2a778aa259feeb04552171;hp=0000000000000000000000000000000000000000;hpb=0bdc9d38dfd3de07aad929f6629f8fa65d434c27;p=gitmo%2FMouse.git diff --git a/t/100_bugs/029_instance_application_role_args.t b/t/100_bugs/029_instance_application_role_args.t new file mode 100644 index 0000000..c1f431b --- /dev/null +++ b/t/100_bugs/029_instance_application_role_args.t @@ -0,0 +1,55 @@ +#!/usr/bin/perl +# This is automatically generated by author/import-moose-test.pl. +# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!! +use t::lib::MooseCompat; +use strict; +use warnings; +use Test::More; +use Test::Exception; + +{ + package Point; + use Mouse; + + with qw/DoesNegated DoesTranspose/; + + has x => ( isa => 'Int', is => 'rw' ); + has y => ( isa => 'Int', is => 'rw' ); + + sub inspect { [$_[0]->x, $_[0]->y] } + + no Mouse; +} + +{ + package DoesNegated; + use Mouse::Role; + + sub negated { + my $self = shift; + $self->new( x => -$self->x, y => -$self->y ); + } + + no Mouse::Role; +} + +{ + package DoesTranspose; + use Mouse::Role; + + sub transpose { + my $self = shift; + $self->new( x => $self->y, y => $self->x ); + } + + no Mouse::Role; +} + +my $p = Point->new( x => 4, y => 3 ); + +DoesTranspose->meta->apply( $p, -alias => { transpose => 'negated' } ); + +is_deeply($p->negated->inspect, [3, 4]); +is_deeply($p->transpose->inspect, [3, 4]); + +done_testing;