David Cantrell
2012-12-07 21:45:19 UTC
Just for a bit of fun I thought I'd see how well covered one of my
modules is, so I picked Class::Mockable as the victim. It found two
places the tests weren't getting to.
One of them was easy to fix. The other ... not so easy.
Line 17 of http://git.io/czMevQ is allegedly not fully covered. It *is*
tested though, in the default_ok() sub of http://git.io/W9qSzg - what
that does is deliberately set up a mock object, not use it, and so when
the object goes out of scope its DESTROY method calls
__PACKAGE__->_ok->(0, "blah blah") to generate a test failure. That's
done in a separate process though, whose output is captured by
Capture::Tiny::capture(). My test then checks the captured text, sees
/^not ok .../ and emits a normal ok(...).
I'm at a loss as to why Devel::Cover isn't spotting that though, because
all I'm running is 'HARNESS_PERL_SWITCHES=-MDevel::Cover make test' so
any child processes should be "infected" by that environment variable.
Anyone got any clues?
modules is, so I picked Class::Mockable as the victim. It found two
places the tests weren't getting to.
One of them was easy to fix. The other ... not so easy.
Line 17 of http://git.io/czMevQ is allegedly not fully covered. It *is*
tested though, in the default_ok() sub of http://git.io/W9qSzg - what
that does is deliberately set up a mock object, not use it, and so when
the object goes out of scope its DESTROY method calls
__PACKAGE__->_ok->(0, "blah blah") to generate a test failure. That's
done in a separate process though, whose output is captured by
Capture::Tiny::capture(). My test then checks the captured text, sees
/^not ok .../ and emits a normal ok(...).
I'm at a loss as to why Devel::Cover isn't spotting that though, because
all I'm running is 'HARNESS_PERL_SWITCHES=-MDevel::Cover make test' so
any child processes should be "infected" by that environment variable.
Anyone got any clues?
--
David Cantrell | A machine for turning tea into grumpiness
David Cantrell | A machine for turning tea into grumpiness