Re: Code coverage tools?
[email protected] (Matt S Trout)
| Newsgroups | perl.moose |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Feb 02, 2008 at 01:59:42PM -0500, Noel Maddy wrote: > >>> "Stevan Little" <[email protected]> 02/02/08 11:24 AM > >>> > > On Feb 1, 2008, at 2:57 PM, Noel Maddy wrote: > > > > > 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. > > Yeah -- but moving the code into a 'builder' method, like Matt > suggested, takes care of it elegantly -- or should I say moosishly? ;) For added bonus points, now the full power of method modifiers is available to help modify the way your defaults work. I can't say I actually use default any more except for brain-dead simple stuff like returning an empty arrayref/hashref and similar, which I'm reasonably happy not testing/covering directly. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Director http://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/