From: Arthur Axel 'fREW' Schmidt Date: Fri, 26 Apr 2013 22:09:01 +0000 (-0500) Subject: more tests X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Ftopic%2Fstop-overriding-subs-w-handles;p=gitmo%2FMoose.git more tests --- diff --git a/t/bugs/sub-and-handles.t b/t/bugs/sub-and-handles.t index f183bd8..f39001f 100644 --- a/t/bugs/sub-and-handles.t +++ b/t/bugs/sub-and-handles.t @@ -52,10 +52,36 @@ use Test::More; sub _bar { 'extended' } has '+_barrer' => ( is => 'rw' ); + + package D; + + use Moose; + extends 'ConsumesDelegateToBar'; + + sub _bar { 'extended' } + + has '+_barrer' => ( + is => 'rw', + handles => { _baz => 'bar' }, + ); + package C; + + use Moose; + 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;