From: Arthur Axel 'fREW' Schmidt Date: Fri, 26 Apr 2013 22:09:01 +0000 (-0500) Subject: more tests (because I cannot believe that fixed it) X-Git-Tag: v1.002000~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2d594586cd91096e01134cd473d610366a87bcc6;p=gitmo%2FMoo.git more tests (because I cannot believe that fixed it) --- diff --git a/Changes b/Changes index a0f1dc9..f663819 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,4 @@ + - don't pass 'handles' down when doing 'has +' to avoid unDWIMmy explosions - throw a useful exception when typemap doesn't return a value - avoid localising @_ when not required for Sub::Quote - successfully inflate a metaclass for attributeless classes (RT#86415) diff --git a/t/sub-and-handles.t b/t/sub-and-handles.t index 2c96ad7..58998cf 100644 --- a/t/sub-and-handles.t +++ b/t/sub-and-handles.t @@ -50,10 +50,36 @@ use Test::More; sub _bar { 'extended' } has '+_barrer' => ( is => 'rw' ); + + package D; + + use Moo; + extends 'ConsumesDelegateToBar'; + + sub _bar { 'extended' } + + has '+_barrer' => ( + is => 'rw', + handles => { _baz => 'bar' }, + ); + package C; + + use Moo; + extends 'ConsumesDelegateToBar'; + with 'Does::OverrideDelegate'; + + has '+_barrer' => ( + is => 'rw', + handles => { _baz => 'bar' }, + ); } is(A->new->_bar, 'extended', 'overriding delegate method with role works'); +is(D->new->_bar, 'extended', '... even when you specify other delegates in subclass'); +is(D->new->_baz, 'unextended!', '... and said other delegate still works'); is(B->new->_bar, 'extended', 'overriding delegate method directly works'); +is(C->new->_bar, 'extended', '... even when you specify other delegates in subclass'); +is(C->new->_baz, 'unextended!', '... and said other delegate still works'); done_testing;