Re: Discourage use_ok?

2009-11-09 Thread Ovid
- Original Message > From: Erik Osheim > To: perl-qa@perl.org > Sent: Mon, 9 November, 2009 17:15:52 > Subject: Re: Discourage use_ok? > > On Mon, Nov 09, 2009 at 04:32:18PM +, David Cantrell wrote: > > Why not test that the script *works*, not just that it compiles? Agreed, but it

Re: Discourage use_ok?

2009-11-09 Thread Eric Wilhelm
# from Ovid # on Monday 09 November 2009 02:11: >but can be viewed as tests themselves!  If either "use My::Module" or > "require My::Module" fails, ... Yeah, that's how I always do it. >The *only* use I've ever had for use_ok() has been in a t/00-load.t > test which attempts to load all modules

Re: Discourage use_ok?

2009-11-09 Thread Erik Osheim
On Mon, Nov 09, 2009 at 04:32:18PM +, David Cantrell wrote: > Why not test that the script *works*, not just that it compiles? That's a good idea. Maybe something like run_ok()? -- Erik

Re: Discourage use_ok?

2009-11-09 Thread Michael Peters
On 11/09/2009 05:24 AM, Ovid wrote: Thinking about this more, what about a compile_ok()? It merely asserts that the code compiles (in an anonymous namespace, perhaps?), but doesn't make any guarantees about you being able to even use the code -- just that it compiles. It wouldn't need to be

Re: Discourage use_ok?

2009-11-09 Thread David Cantrell
On Mon, Nov 09, 2009 at 11:41:21AM +0100, Philippe Bruhat (BooK) wrote: > On Mon, Nov 09, 2009 at 02:24:11AM -0800, Ovid wrote: > > Thinking about this more, what about a compile_ok()? > compile_ok() would certainly be interesting with scripts shipped with > a module, that usually have very little

Re: Discourage use_ok?

2009-11-09 Thread Ovid
--- On Mon, 9/11/09, David Golden wrote: > From: David Golden > I don't see any problem with require_ok.  I've found > it useful as a > cheap sanity check and don't see the action at a distance > problems you > imply. use Test::More tests => $gazillion; require_ok $some_module; run_gazil

Re: Discourage use_ok?

2009-11-09 Thread David Golden
(n Mon, Nov 9, 2009 at 5:11 AM, Ovid wrote: > For the life of me, I can't really see any utility to use_ok() or > require_ok().  Not only are both fragile and a source of strange "action at a > distance" bugs, but the constructs they replace not only work correctly, but I don't see any problem

Re: Discourage use_ok?

2009-11-09 Thread Paul Johnson
On Mon, Nov 09, 2009 at 02:11:23AM -0800, Ovid wrote: > What do people think? Should we start discouraging the use of these tests? I've never found them useful and, as you note, they can cause pain. I remember narrowing down one Devel::Cover bug report to the code being covered not putting use_

Re: Discourage use_ok?

2009-11-09 Thread Erik Osheim
On Mon, Nov 09, 2009 at 02:11:23AM -0800, Ovid wrote: > For the life of me, I can't really see any utility to use_ok() or > require_ok(). Not only are both fragile and a source of strange > "action at a distance" bugs, but the constructs they replace not only > work correctly, but can be viewed as

Re: Discourage use_ok?

2009-11-09 Thread Gabor Szabo
On Mon, Nov 9, 2009 at 12:41 PM, Philippe Bruhat (BooK) wrote: > On Mon, Nov 09, 2009 at 02:24:11AM -0800, Ovid wrote: >> --- On Mon, 9/11/09, Ovid wrote: >> >> > From: Ovid >> >> > The *only* use I've ever had for use_ok() has been in a >> > t/00-load.t test which attempts to load all modules a

Re: Discourage use_ok?

2009-11-09 Thread Ovid
--- On Mon, 9/11/09, Philippe Bruhat (BooK) wrote: > compile_ok() would certainly be interesting with scripts > shipped with > a module, that usually have very little meat that needs > testing (since > most of the work is done in the modules), but that one > would at least > check that they compi

Re: Discourage use_ok?

2009-11-09 Thread Philippe Bruhat (BooK)
On Mon, Nov 09, 2009 at 02:24:11AM -0800, Ovid wrote: > --- On Mon, 9/11/09, Ovid wrote: > > > From: Ovid > > > The *only* use I've ever had for use_ok() has been in a > > t/00-load.t test which attempts to load all modules and does > > a BAIL_OUT if it fails.  I'm sure there are other use > >

Re: Discourage use_ok?

2009-11-09 Thread Ovid
--- On Mon, 9/11/09, Ovid wrote: > From: Ovid > The *only* use I've ever had for use_ok() has been in a > t/00-load.t test which attempts to load all modules and does > a BAIL_OUT if it fails.  I'm sure there are other use > cases, but if that's the only one, it seems a very, very > slim justif

Discourage use_ok?

2009-11-09 Thread Ovid
I've been toying with this thought for a while: discourage (not quite deprecate) use_ok() and require_ok(). I've written up some of the problems with the former (http://use.perl.org/~Ovid/journal/39859) and the latter still has the "or die" problem. For the life of me, I can't really see any u