Test-More / TB2

Test::Builder version 2, the next generation of building testing modules in Perl
Other
1 stars 0 forks source link

Use Carp #202

Closed schwernbot closed 10 years ago

schwernbot commented 10 years ago

From: @schwern Date: Thursday Feb 23, 2012 at 20:55 GMT Orig: https://github.com/Test-More/test-more/issues/256

Previously, we avoided using Carp because if Test::More loads too many modules it might interfere with testing if a module will load on its own. For example, if a module forgets to load Carp it will work in the tests but not in production.

I don't believe this position is tenable any longer. Our Carp work around (see _carp() in Test::More) only works one level down. TB2 has far deeper nesting of errors and needs the ability to look up through packages. Rather than reimplement this, I think it's better to just use Carp. The bump to 5.8 means we can use more core modules, which will load Carp (and other modules).

schwernbot commented 10 years ago

From: @schwern Date: Wednesday Aug 01, 2012 at 18:53 GMT Orig: https://github.com/Test-More/test-more/issues/256#issuecomment-7436356

Looking at this again, the Test::Builder carp and croak methods work fine. Probably better than Carp for our purposes because they know exactly where the test function was called from.

So replace _carp with $tb->carp and leave the Carp exception in .perlcritic.

schwernbot commented 10 years ago

From: @schwern Date: Wednesday Aug 01, 2012 at 19:32 GMT Orig: https://github.com/Test-More/test-more/issues/256#issuecomment-7437454

Great!