X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F019-handles.t;h=9208a3c8fc6475922b293cc68fabf8ddca921c3d;hb=8a3e5c5d45741e488e89d5130b5dcb44f2c6a6f4;hp=03797d639c3ee84f0de0285cf034432f61835eeb;hpb=1ea948d15121718612bb301c9a4f8040c5fd0e9f;p=gitmo%2FMouse.git diff --git a/t/019-handles.t b/t/019-handles.t index 03797d6..9208a3c 100644 --- a/t/019-handles.t +++ b/t/019-handles.t @@ -1,7 +1,8 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 24; +use Test::More tests => 28; +use Test::Exception; do { package Person; @@ -117,3 +118,30 @@ is_deeply( "correct handles layout for 'person'", ); + +{ + local $TODO = "failed on some environment, but I don't know why it happens (gfx)"; + throws_ok{ + $object->person(undef); + $object->person_name(); + } qr/Cannot delegate person_name to name because the value of person is not defined/; + + throws_ok{ + $object->person([]); + $object->person_age(); + } qr/Cannot delegate person_age to age because the value of person is not an object/; +} + +eval{ + $object->person(undef); + $object->person_name(); +}; +like $@, qr/Cannot delegate person_name to name because the value of person is not defined/; + +eval{ + $object->person([]); + $object->person_age(); +}; +like $@, qr/Cannot delegate person_age to age because the value of person is not an object/; + +