On 2012.4.11 9:53 AM, Aristotle Pagaltzis wrote:
> * Michael G Schwern <schw...@pobox.com> [2012-04-11 18:35]:
>> Nope, too much magic for too small a use case.
> 
> And faithfully duplicating `use` would be less so? :-)

This discussion is about backing away from that.  The most magical bits of
use_ok() have not yet gone out in a stable and can be reverted.


> I don’t see how it is any more magic than `done_testing`.

done_testing() has no global side effects, it's just a function.

Unless I'm mistaken, Test::AutoBailOut is doing to need a global $SIG{__DIE__}
handler or override CORE::require or add something to @INC or try to parse
exception messages or something like that.  Any of those have global side
effects which can potentially interfere with or be overwritten by the code
being tested.


> What exactly makes you uneasy? Maybe there is a way to address that
> if you can be more specific.

Mostly that it's cramming yet more complexity into core test library for a
fairly narrow use case and functionality that lives quite happily in its own
module.  It's already difficult enough to keep stable.

To reverse it, why should it be in Test::More?  "People don't like to have
extra test dependencies" is not accepted.  If you want to bundle it all
together into a sort of universal set of testing extensions, Test::Most does 
that.

While it could be argued that every distribution should be testing that their
modules load and bailing out if they don't, the bailing out part we can live
without.  But it is handy.


>> It works fine if what you want is a runtime require + import + assert,
>> and sometimes you want that.  The problem is it's been overused and
>> has come to replace a simple `use` in test scripts.  To that end the
>> question is whether to *discourage* its use in the documentation: to
>> scale it back from "use this when you load a module" to "use this for
>> some special cases".
> 
> *Which* special cases? I would rather not recommend it in any case ever.

In my reply to Andy I outlined some cases where you need a runtime require +
import + assert and its better to have a function which does that than write
it all out by hand.


> My suggestion to ship AutoBailOut was so you would be able to suggest it
> as a replacement in the docs, as it covers the one case where `use_ok`
> is even of interest (though still not the right solution).
> 
> But I guess you could do that even if it ships outside of Test::More.

Precisely.  For example, it already suggests Test::Differences and Test::Deep.


-- 
185. My name is not a killing word.
    -- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army
           http://skippyslist.com/list/

Reply via email to