X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Faccessors_xs_cachedwarn.t;h=7b9dfaf2211aeb276e02022aedec5137dc8dc9a5;hb=341239e1e2ce3ff7a97427bf5fdee3117dc081a4;hp=6b17dd4622c6a79daad480da88c08057e22352f0;hpb=e6f2993f0eaf4c08632889be16acd8dada42fb6c;p=p5sagit%2FClass-Accessor-Grouped.git diff --git a/t/accessors_xs_cachedwarn.t b/t/accessors_xs_cachedwarn.t index 6b17dd4..7b9dfaf 100644 --- a/t/accessors_xs_cachedwarn.t +++ b/t/accessors_xs_cachedwarn.t @@ -1,8 +1,5 @@ use strict; use warnings; -use FindBin qw($Bin); -use File::Spec::Functions; -use File::Spec::Unix (); # need this for %INC munging use Test::More; use lib 't/lib'; @@ -21,6 +18,7 @@ use AccessorGroupsSubclass; $Class::Accessor::Grouped::USE_XS = 1; my $obj = AccessorGroupsSubclass->new; +my $obj2 = AccessorGroups->new; my $deferred_stub = AccessorGroupsSubclass->can('singlefield'); my @w; @@ -30,12 +28,20 @@ my @w; is ($obj->$deferred_stub, 1, 'Get'); is ($obj->$deferred_stub(2), 2, 'ReSet'); is ($obj->$deferred_stub, 2, 'ReGet'); + + is ($obj->singlefield, 2, 'Normal get'); + is ($obj2->singlefield, undef, 'Normal get on unrelated object'); } +is (@w, 3, '3 warnings total'); + is ( scalar (grep { $_ =~ /^\QDeferred version of method AccessorGroups::singlefield invoked more than once/ } @w), - 3 - '3 warnings produced as expected on cached invocation during testing' -); + 3, + '3 warnings produced as expected on cached invocation during testing', +) or do { + require Data::Dumper; + diag "\n \$0 is: " . Data::Dumper->new([$0])->Useqq(1)->Terse(1)->Dump; +}; done_testing;