Re: [PATCH Test/Simple.pm Test/More.pm] Add skip_rest() Function

2001-10-11 Thread Michael G Schwern

On Sat, Sep 15, 2001 at 12:42:57AM -0600, chromatic wrote:
 I've just added a really simple convenience function that skips the
 rest of the tests in a suite.  It's different from the normal skip()
 in that it doesn't require nested named blocks.

I'm wary of putting this in.  I'm afraid that a skip_rest() in a test
wouldn't last long under continued additions to the test.  It imposes
a restriction that every test below that point must be effected by it,
and anything you don't want skipped must be above it which seems to me
too broad.

I'm curious what trouble you ran into with the usual SKIP block.


-- 

Michael G. Schwern   [EMAIL PROTECTED]http://www.pobox.com/~schwern/
Perl6 Quality Assurance [EMAIL PROTECTED]   Kwalitee Is Job One
Only mindless violence can raise my spirits now!



Re: [PATCH Test/Simple.pm Test/More.pm] Add skip_rest() Function

2001-10-11 Thread chromatic

On Wednesday 10 October 2001 12:46, Michael G Schwern wrote:

 I'm wary of putting this in.  I'm afraid that a skip_rest() in a test
 wouldn't last long under continued additions to the test.  It imposes
 a restriction that every test below that point must be effected by it,
 and anything you don't want skipped must be above it which seems to me
 too broad.

That's a good point.  I see this as helpful in situations like the 
Term::Complete test, where there's a range of configurations where the test 
can't be run at all.  If the test gets to that point, it's not worth even 
attempting to continue.

It may just be that we're getting in to the Hard To Test Portably modules now 
in the core, where this is much more common than normal.

 I'm curious what trouble you ran into with the usual SKIP block.

It's doable there, yes.  I just don't like the potential of nesting them.

Of course, commenting tests well does a lot for maintenance too... but that's 
another rant and rave.

-- c



Re: [PATCH Test/Simple.pm Test/More.pm] Add skip_rest() Function

2001-10-11 Thread Michael G Schwern

On Thu, Oct 11, 2001 at 09:47:08AM -0600, chromatic wrote:
 That's a good point.  I see this as helpful in situations like the 
 Term::Complete test, where there's a range of configurations where the test 
 can't be run at all.  If the test gets to that point, it's not worth even 
 attempting to continue.

Ok, what I think I'll do is make skip() work outside of SKIP blocks.
This will make it trivial for you to write:

skip_rest {
my($reason, $num) = @_;
skip($reason, $num);
exit;
}

in the cases it's necessary.

-- 

Michael G. Schwern   [EMAIL PROTECTED]http://www.pobox.com/~schwern/
Perl6 Quality Assurance [EMAIL PROTECTED]   Kwalitee Is Job One
purl Hey, Schwern!  THERE IS A HUGE GAZORGANSPLATTEDFARTMONGERING-
LIGHTENINGBEASTASAURSOPOD BEHIND YOU!  RUN, BEFORE IT GAFLUMMOXES YOUR
INNARDLYBITS!



Test::Simple's very slight side effect

2001-10-11 Thread Tatsuhiko Miyagawa

Here is an example of very slight side effect of using Test::More
in test suite, which I had trouble with today.

  package Bareword::Freaks;
  
  sub foobar {
  require Carp;
  Carp::croak 'blah';
  }
  
  1;

This will be a compile error:

  String found where operator expected at - line 5, near Carp::croak 'blah'
(Do you need to predeclare Carp::croak?) 


But, the following test couldn't detect it: It compiles okay.

  use strict;
  use Test::More tests = 1;
  BEGIN { use_ok 'Bareword::Freaks'; }


It is because Test::More use()s Carp, thus defines Carp::croak at
compile time before loading Bareword::Freaks. Duh.


--
Tatsuhiko Miyagawa [EMAIL PROTECTED]