[dancer-users] Dancer::Test + Devel::Cover + subroutine attributes == PAIN
Aaron Crane
perl at aaroncrane.co.uk
Wed Nov 28 17:32:43 GMT 2012
David Cantrell <david at cantrell.org.uk> wrote:
> Has anyone else worked with Dancer and
> Devel::Cover and got any tips for me, or am I going to have to delve
> into the lump of pure concentrated EVIL that is the Devel::Cover source?
I think this is all Devel::Cover — you can demonstrate the same
behaviour (that the attribute-bearing coderef gets re-cloned at some
point when the code is run under Devel::Cover) without involving
Dancer at all:
$ cat foo.pl
use strict;
use warnings;
use Test::More tests => 1;
use Attribute::Handlers;
my $attributed;
sub Foo :ATTR(CODE) {
my ($package, $symbol, $referent, $attr, $data) = @_;
$attributed = "$referent";
}
my $sub = sub :Foo(bar) {};
is($attributed, "$sub", "coderef with attributes is not re-cloned");
$ prove foo.pl
foo.pl .. ok
All tests successful.
Files=1, Tests=1, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.02 cusr
0.00 csys = 0.05 CPU)
Result: PASS
$ PERL5OPT=-MDevel::Cover prove foo.pl
foo.pl .. 1/1
# Failed test 'coderef with attributes is not re-cloned'
# at foo.pl line 16.
# got: 'CODE(0x100ab7138)'
# expected: 'CODE(0x100adba80)'
# Looks like you failed 1 test of 1.
foo.pl .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests
Test Summary Report
-------------------
foo.pl (Wstat: 256 Tests: 1 Failed: 1)
Failed test: 1
Non-zero exit status: 1
Files=1, Tests=1, 0 wallclock secs ( 0.05 usr 0.01 sys + 0.31 cusr
0.02 csys = 0.39 CPU)
Result: FAIL
So my suggestion would be to ask the same question on the perl-qa list:
http://lists.perl.org/list/perl-qa.html
--
Aaron Crane ** http://aaroncrane.co.uk/
More information about the dancer-users
mailing list