Re: Code coverage tools?

[email protected] (Stevan Little)
Newsgroups perl.moose
Message-ID <[email protected]>
On Feb 1, 2008, at 2:57 PM, Noel Maddy wrote:

> I'm starting to work with Moose, and I'm really impressed
> with its design.
>
> However, I'm used to using Devel::Cover for code coverage,
> and it seems to skip code in Moose's attribute default coderefs.

Well, it is possible that it is actually checking that code since  
Devel::Cover hooks into perl at runtime to check code coverage,  
however it cannot report on it since it cannot match it to the actual  
source. This is a common issue with code generation modules like Moose.

> I assume it would also skip code in MooseX::Method definitions?

Actually, I think Anders worked really hard to get Devel::Cover to  
work with MX::Method, although I don't know what the final outcome was.

> Is there any way to get Devel::Cover to do code coverage on
> the Moose coderefs? Or is there another code coverage tool
> that works with Moose?

No, there isn't anything but Devel::Cover as far as I know. However,  
to be completely honest, the code that Moose generates has already  
been tested pretty thoroughly in the Moose test suite and it's  
behavior verified. So you really shouldn't need to worry about having  
to re-test it yourself. Personally, when I test code-coverage on my  
Moose based modules, I tend to just look to make sure I have coverage  
on *my* methods and don't worry about the Moose generated stuff.

- Stevan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.