Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-Deep CPAN distribution.

Report information
The Basics
Id: 16306
Status: resolved
Priority: 0/
Queue: Test-Deep

People
Owner: Nobody in particular
Requestors: natg [...] shore.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.093
Fixed in: (no value)



Subject: methods doens't work for AUTOLOADed methods
The methods comparison doesn't work on AUTOLOADed methods. Here's a test case, module first and then script. ---------- package TestDeepAutoloadBug; sub new {return bless {},'TestDeepAutoloadBug'} sub works {return 1} use vars qw($AUTOLOAD); sub AUTOLOAD { my $self=shift; my $method=$AUTOLOAD; $method=~s/^.*:://; # strip class qualification return if $method eq 'DESTROY'; # the books say you should do this return 1; } 1; ---------- use Test::More qw/no_plan/; use Test::Deep; use TestDeepAutoloadBug; $obj=new TestDeepAutoloadBug; cmp_deeply($obj,methods(works=>1),'this one works, of course'); cmp_deeply($obj,methods(bug=>1),'this one does not work'); ---------- The obvious fix is to invoke the method inside an eval rather than relying on UNIVERSAL::can in Test::Deep::Methods::descend. (This suggestion presupposes that my weak understanding of the code is even marginally accurate :) I don't know what the performance impact might be. Thanks, Nat Goodman
Date: Wed, 7 Dec 2005 15:17:09 +0000
From: Fergal Daly <fergal [...] esatclear.ie>
To: bug-Test-Deep [...] rt.cpan.org
Subject: Re: [cpan #16306] methods doens't work for AUTOLOADed methods
RT-Send-Cc:
This is a slightly tricky one. I think my reasoning for not using a eval was that if the code inside the method dies it should kill the test, just as would happen if you run a method directly in a test. Maybe I'll do an eval and look at the error message... it'll be a few days before I get to do this either way,
I believe this is fixed by https://github.com/rjbs/Test-Deep/commit/09521073f0e6b9216af9261497f9d137050d2551 ...and will cut a release in a few days, probably. -- rjbs
Subject: Re: [rt.cpan.org #16306] methods doens't work for AUTOLOADed methods
Date: Sun, 1 Apr 2012 11:04:22 -0700
To: bug-Test-Deep [...] rt.cpan.org
From: "Nathan (Nat) Goodman" <ngoodman [...] systemsbiology.org>
Thanks! I'll keep an eye out for the release. Best, Nat On Apr 1, 2012, at 9:35 AM, Ricardo Signes via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=16306 > > > I believe this is fixed by > > https://github.com/rjbs/Test-Deep/commit/09521073f0e6b9216af9261497f9d137050d2551 > > ...and will cut a release in a few days, probably. > > -- > rjbs
I should have closed this ages ago. -- rjbs