develooper Front page | perl.perl5.porters | Postings from March 2011

Re: [perl #87064] Semi-Semicolons test suite is broken since perl5.13.7

Thread Previous | Thread Next
From:
Zefram
Date:
March 30, 2011 07:32
Subject:
Re: [perl #87064] Semi-Semicolons test suite is broken since perl5.13.7
Message ID:
20110330143148.GB23646@lake.fysh.org
Dave Mitchell wrote:
>But of course, if does the goto (to get the correct caller lexical scope),
>then it's too late to print 'not ok' if the import fails (e.g. if it dies).

True, but it's not a disaster if we change use_ok() to work this way.
It can print "ok" or "not ok" based on whether the require() succeeds,
and then chain the import.  If import dies then the test script dies,
which should adequately signal failure.  The only real losers are test
scripts that relied on being able to continue with other tests after
use_ok(), but that must be a rare usage: usually the later tests depend
on the effects of the import and so will fail anyway.

>So I suspect that use_ok() is fundamentally unsuitable (and not fixable)
>for modules that affect the callers lexical scope.

I think what I outlined above is a better tradeoff than leaving use_ok()
unsuitable for anything with lexical effect.  But probably not a change
to make before 5.14.

>In which case, it's probably best to just document this limitation in
>Test::More, and suggest to Semi-Semicolons's maintainer to avoid
>use_ok().

I think this is the best approach for 5.14.

-zefram

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About