Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Problem when Test::Deep and Test::Class are used together

by mp (Deacon)
on Mar 31, 2006 at 00:38 UTC ( #540331=perlquestion: print w/replies, xml ) Need Help??

mp has asked for the wisdom of the Perl Monks concerning the following question:

When I use Test::Deep within a Test::Class subclass and run the test, I get an error: Test::Deep not Test::Class or integer at 01-TestDeep.t line 6

If the use Test::Deep is commented out, it works fine.

Does anyone know of a workaround for this (other than not using Test::Deep with Test::Class)?

I'm using the latest versions of both modules:
Test::Deep version = 0.093
Test::Class version = 0.11

Project/Test/TestDeep.pm

package Project::Test::TestDeep; use strict; use warnings; use base qw(Test::Class); use Test::More; # If the following line is uncommented, the test fails. #use Test::Deep; sub setup : Tests(setup => 2) { ok(2); } sub test : Tests(2) { ok(1); ok(1); } 1;
test_deep.t:
use strict; use warnings; use PSC::Test::TestDeep; Test::Class->runtests(); exit;

Replies are listed 'Best First'.
Re: Problem when Test::Deep and Test::Class are used together
by adrianh (Chancellor) on Apr 01, 2006 at 16:26 UTC

    This is happening because Test::Deep defines it's own isa() subroutine, which has different functionality from the UNIVERSAL::isa.

    This means that when runtests() is doing it's automagical "find all test classes" using Test::Deep->isa('Test::Class') it always get a true value - so incorrectly treats it as a Test::Class.

    Expect a patched Test::Class soon :-)

      Hmm, that's interesting. It's not really a bug to have an isa subroutine in a non-OO module but it can lead to confusion. If it wasn't part of the interface I'd rip it out.
        Hmm, that's interesting. It's not really a bug to have an isa subroutine in a non-OO module but it can lead to confusion.

        Yup. Yet another quirk of Perl 5's OO system :-/

Re: Problem when Test::Deep and Test::Class are used together
by adrianh (Chancellor) on Oct 04, 2006 at 16:18 UTC
    This has been fixed in the 0.15 release that should be hitting CPAN any second now. (get there in the end :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://540331]
Approved by monkfan
Front-paged by diotalevi
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2019-10-21 04:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?