Front page | perl.perl5.porters |
Postings from January 2001
Re: [PATCH Test.pm 1.14] (was Re: Unifying 'skip' and 'todo' test output)
Thread Previous
|
Thread Next
From:
H . Merijn Brand
Date:
January 18, 2001 02:30
Subject:
Re: [PATCH Test.pm 1.14] (was Re: Unifying 'skip' and 'todo' test output)
Message ID:
20010118112345.30F5.H.M.BRAND@hccnet.nl
On Thu, 18 Jan 2001 00:16:03 -0600, Michael G Schwern <schwern@pobox.com> wrote:
> On Wed, Jan 17, 2001 at 06:37:33PM -1000, Tim Jenness wrote:
> > On Wed, 17 Jan 2001, Michael G Schwern wrote:
> > This looks okay. One thing that has always surprised me with Test.pm is
> > that it expects you to put the "skip" into the reason.
> >
> > i.e. skip($reason)
> >
> > expects $reason to start with "skip" (it adds the "#") even though you
> > are using the "skip" function. I was going to patch this to add "skip"
> > (and now "todo") but I'll wait until your patch unless you beat me to it.
>
> That's tangental to the issue, and up to Joshua. And it probably can't
> be fixed without breaking backwards compatibility...
>
> # Currently works, but if "fixed" it will produce
> # '# skip skip lunch break'
> skip("skip lunch break");
>
> However, you could always add a little logic to skip to help that...
>
> --- Test.pm 2001/01/18 01:27:22 1.1
> +++ Test.pm 2001/01/18 06:06:42
> @@ -122,8 +122,11 @@
> sub skip ($$;$$) {
> my $whyskip = to_value(shift);
> if ($whyskip) {
> + $whyskip =~ s/^skip//i; # backwards compatibility, old versions
$whyskip =~ s/^skip\s*//i;
> + # required the reason to start with
> + # 'skip'
> $whyskip = 'skip' if $whyskip =~ m/^\d+$/;
> - print $TESTOUT "ok $ntest # $whyskip\n";
> + print $TESTOUT "ok $ntest # skip $whyskip\n";
> ++ $ntest;
> 1;
> } else {
>
> This also necesitates a change to t/skip.t
>
> --- t/skip.t 2001/01/18 06:11:52 1.1
> +++ t/skip.t 2001/01/18 06:12:09
> @@ -30,8 +30,8 @@
> END { close F; unlink "skips" }
>
> __DATA__
> -ok 1 # skip
> +ok 1 # skip skip
>
> -ok 2 # hop
> +ok 2 # skip hop
>
> -ok 3 # jump
> +ok 3 # skip jump
>
>
> The fact that this patch blows a regression test worries me. Does
> skip() have any valid utility if its first argument doesn't begin with
> 'skip'? Is skip('hop') useful (before the patch)?
>
>
> > The problem is exacerbated by the Test.pm documentation that doesn't
> > explain this - you should be able to use Test.pm without having to
> > understand how Test::Harness recognizes failures/skips/todo
>
> Yes, the documentation for skip() (and ok()) is very unclear and never
> explicitly documented. The third argument to ok() is never really
> explained at all! I'm going to hold on patching this up until Joshua
> gets a say in.
>
>
> PS I'm going to be tidying up my personal testing code and releasing
> it shortly. Its nothing fabulous, but I'm getting tired of cutting
> and pasting my ok() routines into my test scripts.
>
>
> --
> Michael G. Schwern <schwern@pobox.com> http://www.pobox.com/~schwern/
> You see, in this world there's two kinds of people. Those with loaded
> guns, and those who dig. Dig.
> -- Blonde, "The Good, The Bad And The Ugly"
--
H.Merijn Brand Amsterdam Perl Mongers (http://www.amsterdam.pm.org/)
using perl-5.005.03, 5.6.0, 5.6.1, 5.7.1 & 623 on HP-UX 10.20 & 11.00, AIX 4.2
AIX 4.3, WinNT 4.0 SP-6a, and Win2000pro often with Tk800.022 &/| DBD-Unify
ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/
Thread Previous
|
Thread Next