I recently stumbled upon Test::Exception, and wondered if it might make
my test scripts any better.. So far I'm struggling to see any benefit,
for quite a lot of cost.

Without using this module, my tests look like:

    eval { code() };
    ok( $@, 'An exception is raised' );

(and possibly either of)
    like( $@, qr/some string match/, 'Exception type' );
(or)
    ok( [EMAIL PROTECTED]>isa( "Thing" ), 'Exception type' );
(to check the type)

Whereas, if I want to use the module, I have to first note that it isn't
standard install, so I should start the test with something like:

    eval { require Test::Exception; import Test::Exception; };
    my $can_test_exception = $@ ? 0 : 1;

Then each test that might use it should be:

    SKIP: {
        skip "No Test::Exception", 1 unless $can_test_exception;

        dies_ok( sub { code() },
                 'An exception is raised' );
    }

So, a lot more code, to achieve the same end result... Plus, I'm now in
the situation where if Test::Exception isn't installed, the test won't
be run at all.

Have I missed something here? Does Test::Exception provide me with some
greater functionallity I haven't yet observed? Or should I just not
bother using it?

-- 
Paul "LeoNerd" Evans

[EMAIL PROTECTED]
ICQ# 4135350       |  Registered Linux# 179460
http://www.leonerd.org.uk/

Attachment: signature.asc
Description: Digital signature

Reply via email to