Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: How can I write Test::Finished?

by schwern (Scribe)
on Jun 22, 2004 at 19:53 UTC ( #368834=note: print w/replies, xml ) Need Help??

in reply to How can I write Test::Finished?

Overriding CORE::exit() is probably the simplest thing to do, I'm planning on building that into Test::More once I'm convinced there's a real need. POSIX::_exit() is another one. Override them so they set a flag and check for that flag in an END block (END blocks are still run even when exit()ing).

I don't think there's anything you can do about a direct call to CORE::exit() but that's about as unlikely as they come.

Filters are just asking for trouble.

I've never run into this problem in the real world so I'm less than convinced it needs addressing. Has an exit(0) bitten anyone else?

-- Michael G Schwern

Replies are listed 'Best First'.
Re^2: How can I write Test::Finished?
by samtregar (Abbot) on Jun 22, 2004 at 20:57 UTC
    That sounds reasonable and it's probably the easiest thing that could possibly work.

    BTW, how come exit(1) gets ignored by Test::Harness? I've got this in bad.t:

    use Test::More qw(no_plan); ok(1); exit(1); ok(1);

    But when I run a make test:

    $ make test PERL_DL_NONLAZY=1 /usr/local/bin/perl -Iblib/arch -Iblib/lib -I/usr/ +local/lib/perl5/5.6.1/i686-linux -I/usr/local/lib/perl5/5.6.1 -e 'use + Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t +/*.t t/bad....ok All tests successful. Files=1, Tests=1, 0 wallclock secs ( 0.02 cusr + 0.01 csys = 0.03 + CPU)

    What gives? I've got Test::Harness v2.32 and Test::More v0.47.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://368834]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2018-06-22 23:06 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (124 votes). Check out past polls.