Re: Fwd: FAIL Module-InstalledVersion-0.02 cygwin-multi 1.3.2(0.3932)

2001-09-14 Thread Richard Clamp

On Thu, Sep 13, 2001 at 07:41:39PM -0400, Kirrily 'Skud' Robert wrote:
> Anyone know what might cause this?  The same reporter also had the same
> problem with CPAN-Test-Reporter.
> $ perl -Mblib t/*.t
> Using /perl/cpantest/Module-InstalledVersion-0.02/blib
> ok 1 - use Module::InstalledVersion;
> ok 2 - create new object for CPAN
> ok 3 - Picked up version of CPAN
> ok 4 - create new object for Fcntl
> ok 5 - Picked up version of Fcntl
> ok 6 - create new object for Text::Wrap
> ok 7 - Picked up version of Text::Wrap
> 1..7

I grew up to expect the 1..7 line to be the first thing emitted from a
test script.

ISTR that the new harness doesn't have that requirement, but this
patch hacks on the test so as not to confuse the older folks.

--- miv.t.orig  Fri Sep 14 10:59:38 2001
+++ miv.t   Fri Sep 14 11:00:11 2001
@@ -1,6 +1,6 @@
 #!/usr/local/bin/perl -w
 
-use Test::More 'no_plan';
+use Test::More tests => 7;
 
 package Catch;
 


-- 
Richard Clamp <[EMAIL PROTECTED]>



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

2001-09-14 Thread chromatic

Hi there,

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.

This came about trying to find a better way to fix t/op/lfs.t in bleadperl.  (I
have a patch for that as well that illustrates my dilemma.  If anyone's
interested, I can post it as well.)

There may be a much more elegant way to solve this.  I'm all ears.  (The POD
patch may rather belong in Test::More instead of Test::Simple, as well.)

-- c

--- lib/Test/~More.pm   Thu Sep  6 06:57:08 2001
+++ lib/Test/More.pmFri Sep 14 23:36:28 2001
@@ -21,7 +21,7 @@
  skip todo
  pass fail
  eq_array eq_hash eq_set
- skip
+ skip skip_rest
  $TODO
  plan
  can_ok  isa_ok

--- lib/Test/~Simple.pm Sat Sep 15 00:29:54 2001
+++ lib/Test/Simple.pm  Sat Sep 15 00:29:30 2001
@@ -57,6 +57,7 @@
 no strict 'refs';
 my($caller) = caller;
 *{$caller.'::ok'} = \&ok;
+*{$caller.'::skip_rest'} = \&skip_rest;
 
 }
 
@@ -199,6 +200,35 @@
 return $test ? 1 : 0;
 }
 
+=cut
+
+=over 4
+
+=item B
+
+   skip_rest();
+   skip_rest( $why );
+
+skip_rest() is given an explanation as to why to skip the rest of the tests.
+It'll happily report "ok $testnum # skip $why" for each skipped test.  If no
+reason is provided, it will just say that it skipped things.  This is a
+last-resort test, to ditch things without having to wrap everything in a SKIP
+block.
+
+=cut
+
+
+sub skip_rest {
+   my($why) = shift;
+
+my $msg;
+   for ($Num_Tests + 1 .. $Planned_Tests) {
+   _skipped($why);
+   ($why) = (split(/\n/, $why))[0];
+   }
+
+exit(0);
+}
 
 sub _skipped {
 my($why) = shift;