From: Yuval Kogman Date: Sun, 5 Jul 2009 23:10:06 +0000 (-0500) Subject: Add a test for class name delegates X-Git-Tag: 0.87~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=227373b3de42a3bda053599db3765086d3c17238;p=gitmo%2FMoose.git Add a test for class name delegates --- diff --git a/t/020_attributes/010_attribute_delegation.t b/t/020_attributes/010_attribute_delegation.t index 100ac3d..a47d7a7 100644 --- a/t/020_attributes/010_attribute_delegation.t +++ b/t/020_attributes/010_attribute_delegation.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 90; +use Test::More tests => 91; use Test::Exception; @@ -21,13 +21,15 @@ use Test::Exception; has 'bar' => (is => 'rw', default => 10); + sub baz { 42 } + package Bar; use Moose; has 'foo' => ( is => 'rw', default => sub { Foo->new }, - handles => { 'foo_bar' => 'bar' } + handles => { 'foo_bar' => 'bar', foo_baz => 'baz' } ); } @@ -420,4 +422,7 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop'); my $j = Bar->new(foo => []); throws_ok { $j->foo_bar } qr/is not an object \(got 'ARRAY/, 'useful error from unblessed reference'; + + my $k = Bar->new(foo => "Foo"); + lives_ok { $k->foo_baz } "but not for class name"; }