* Daniel Risse <[EMAIL PROTECTED]> [2006-08-08 05:10]:
> So something like this:
> 
> use Test::Simple 'no_plan';
> use Test::Terminated;
> 
> # insert tests here
> 
> # signal we made it to the end okay
> terminated_ok();

It occurs to me that you don’t even need that.

Just do something like the following:

    package Test::Terminated;

    our $ok = 0;

    END { die_screaming() if $ok != 1 }

    sub import {
        # ...
        eval qq{
            package $caller_pkg;
            END { ++$Test::Terminated::ok }
        };
    }

You just have to make sure that the END blocks get seen by perl
in the right order to make them run in the proper LIFO order.

That way, simply loading Test::Terminated ensures that the test
has to finish properly, ie. a sufficiently advanced interface, in
TheDamian parlance.

This needs some work to ensure it will play properly with tests
that bail or with skipping the entire file and the like, of
course.

> The only problem I can see with this implementation would be if 
> something could prevent the END block from executing.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

Reply via email to