Subject: | things using Test::Deep::NoTest are untestable with Test::Deep |
Hi,
Here's a bug report[1] we've got for the Debian package of Test-Deep. I
copy it here for completeness.
[1] http://bugs.debian.org/419637
------8<-----
Package: libtest-deep-perl
Version: 0.093-1
Severity: normal
If one uses the convenient eq_deeply function
outside a test scenario (use Test::Deep::NoTest), then
such a program/module is no longer testable using Test::Deep.
When I build a test that does "use Test::Deep" and then accesses
cmp_deeply and friends, I get this error message:
"Can't call method "ok" on an undefined value at
/usr/share/perl5/Test/Deep.pm line 113."
The reason is that while Test:Deep:NoTest avoids pulling in
test::builder, it enforces this for subsequent
Test::Deep imports as well, thus breaking Test::Deep.
I'm not sure how this can be fixed best; looks
like a design issue for the upstream author to ponder.
Maybe it would be best to transplant the code that is not
test-specific to T::D::notest altogether? (and add a
use T::D::notest in T::D)
for eq_deeply this looks trivial (use T::D::Stack, copy the 8 lines
of function, done), not certain about the other functions
that T::D::NoTest exports by default.
For a user of T::D::NoTest, it looks as the only viable temporary
workaround is to "use T::D"; this pulls in Test::Builder but at least
doesn't have any major other nasty side effects.