On 8 Aug 2006, at 04:58, A. Pagaltzis wrote:

* 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.

Of course this one cope with XS code doing a hard exit, or some fool calling POSIX::_exit.

I still think having Test::Harness barf if it doesn't see a 1..N footer is the right way to deal with this.

Did we ever figure out if T::H not doing this was a bug or a feature?

Adrian


Reply via email to