Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Perl: porters

[perl #114296] Refactor t/op/lop.t to use test.pl instead of making TAP by hand

 

 

Perl porters RSS feed   Index | Next | Previous | View Threaded


perlbug-followup at perl

Jul 28, 2012, 2:21 PM

Post #1 of 11 (146 views)
Permalink
[perl #114296] Refactor t/op/lop.t to use test.pl instead of making TAP by hand

# New Ticket Created by Colin Kuskie
# Please include the string: [perl #114296]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=114296 >


I stayed away from using done_testing in this patch since someone
corrected one of the earlier ones where I did use it.

Colin
Attachments: 0009-Update-t-op-lop.t-to-use-test.pl-instead-of-making-T.patch (1.60 KB)


perlbug-followup at perl

Aug 10, 2012, 7:34 PM

Post #2 of 11 (140 views)
Permalink
[perl #114296] Refactor t/op/lop.t to use test.pl instead of making TAP by hand [In reply to]

On Sat Jul 28 14:21:04 2012, colink [at] perldreamer wrote:
> I stayed away from using done_testing in this patch since someone
> corrected one of the earlier ones where I did use it.
>
> Colin

I'm glad that you added content to the names/labels/descriptions -- call
them what you will -- of the first dozen tests. But tests 13 through 18
in the patched file have no descriptions other than their sequence
number. Would it be possible to give them some meaningful descriptions
as well?

Thank you very much.
Jim Keenan


---
via perlbug: queue: perl5 status: new
https://rt.perl.org:443/rt3/Ticket/Display.html?id=114296


perlbug-followup at perl

Aug 10, 2012, 8:43 PM

Post #3 of 11 (145 views)
Permalink
[perl #114296] Refactor t/op/lop.t to use test.pl instead of making TAP by hand [In reply to]

Here's a supplementary patch for that.

---
via perlbug: queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=114296
Attachments: 0010-Document-that-last-five-tests.patch (0.98 KB)


perlbug-followup at perl

Aug 11, 2012, 6:50 AM

Post #4 of 11 (137 views)
Permalink
[perl #114296] Refactor t/op/lop.t to use test.pl instead of making TAP by hand [In reply to]

On Fri Aug 10 20:43:03 2012, colink [at] perldreamer wrote:
> Here's a supplementary patch for that.

When I applied patches 0009 and 0010 in succession, I got one
commented-out line that should probably be removed:

40 # $test == 6
41 my $i = 0;
42 (($i ||= 1) &&= 3) += 4;
43 is( $i, 7, '||=, &&=');

And I also got two lines at the end which don't seem to feed into any test.

49 ++$y;
50 $i = !$x || !$x || !$x || $y;
51 is( $i, 9, 'negation precedence with ||, multiple operands' );
52
53 $x = 0;
54 ++$y;

Thank you very much.
Jim Keenan

---
via perlbug: queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=114296


nick at ccl4

Aug 29, 2012, 1:36 PM

Post #5 of 11 (133 views)
Permalink
Re: [perl #114296] Refactor t/op/lop.t to use test.pl instead of making TAP by hand [In reply to]

On Sat, Jul 28, 2012 at 02:21:05PM -0700, Colin Kuskie wrote:
> # New Ticket Created by Colin Kuskie
> # Please include the string: [perl #114296]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=114296 >
>
>
> I stayed away from using done_testing in this patch since someone
> corrected one of the earlier ones where I did use it.

We don't all agree on everything. I personally tend to find it easier
(because I hate repeatedly re-editing test conts, and I guess historically
I also got burned by them often conflicting on maint-branch integrations)


> >From b35d8d5f3fdbf2c5c0401a35bc02727e0afa1cb1 Mon Sep 17 00:00:00 2001
> From: Colin Kuskie <colink [at] perldreamer>
> Date: Sat, 28 Jul 2012 14:14:45 -0700
> Subject: [PATCH 9/9] Update t/op/lop.t to use test.pl instead of making TAP
> by hand.

Thanks applied as 73ee8f56b01b1a87f68b11ab07bda9013c14f039

Nicholas Clark


nick at ccl4

Aug 29, 2012, 1:36 PM

Post #6 of 11 (133 views)
Permalink
Re: [perl #114296] Refactor t/op/lop.t to use test.pl instead of making TAP by hand [In reply to]

On Fri, Aug 10, 2012 at 08:43:04PM -0700, Colin Kuskie via RT wrote:
> Here's a supplementary patch for that.

I applied this as 6f02a29952bee8a2f755ecdff8223ec5db30a97d, but tweaked
the commit message.

Nicholas Clark


nick at ccl4

Aug 29, 2012, 1:37 PM

Post #7 of 11 (133 views)
Permalink
Re: [perl #114296] Refactor t/op/lop.t to use test.pl instead of making TAP by hand [In reply to]

On Sat, Aug 11, 2012 at 06:50:56AM -0700, James E Keenan via RT wrote:
> On Fri Aug 10 20:43:03 2012, colink [at] perldreamer wrote:
> > Here's a supplementary patch for that.
>
> When I applied patches 0009 and 0010 in succession, I got one
> commented-out line that should probably be removed:
>
> 40 # $test == 6

I removed that in commit 28453e5f3d3167d0f1a72abc434059ee99c2ef96,
along with the declaration of my $test


> And I also got two lines at the end which don't seem to feed into any test.
>
> 49 ++$y;
> 50 $i = !$x || !$x || !$x || $y;
> 51 is( $i, 9, 'negation precedence with ||, multiple operands' );
> 52
> 53 $x = 0;
> 54 ++$y;

I missed this.

What's the right fix here?

[not going to mark this ticket as resolved just yet]

Nicholas Clark


davem at iabyn

Sep 14, 2012, 4:34 AM

Post #8 of 11 (122 views)
Permalink
Re: [perl #114296] Refactor t/op/lop.t to use test.pl instead of making TAP by hand [In reply to]

On Wed, Aug 29, 2012 at 09:36:18PM +0100, Nicholas Clark wrote:
> On Sat, Jul 28, 2012 at 02:21:05PM -0700, Colin Kuskie wrote:
> > I stayed away from using done_testing in this patch since someone
> > corrected one of the earlier ones where I did use it.
>
> We don't all agree on everything. I personally tend to find it easier
> (because I hate repeatedly re-editing test conts, and I guess historically
> I also got burned by them often conflicting on maint-branch integrations)

As the 5.10.1 maint pumpking, I also hated all the merge conflicts caused
by updates to the test count. However, I *really* hate the idea that some
tests are quietly dying or misbehaving or being skipped, and we never
notice.

I've wondered from time to time whether the test infrastructure could be
made to deduce the test count from code comments, e.g.

plan(use_comments);

# TESTS=2
{
is(...);
is(...);
}

# TESTS=3
{
is(...);
is(...);
is(...);
}

so plan() scans the source file and sums all the TESTS=N.

--
In my day, we used to edit the inodes by hand. With magnets.


fawaka at gmail

Sep 14, 2012, 4:56 AM

Post #9 of 11 (122 views)
Permalink
Re: [perl #114296] Refactor t/op/lop.t to use test.pl instead of making TAP by hand [In reply to]

On Wed, Aug 29, 2012 at 10:36 PM, Nicholas Clark <nick [at] ccl4> wrote:
> We don't all agree on everything. I personally tend to find it easier
> (because I hate repeatedly re-editing test conts, and I guess historically
> I also got burned by them often conflicting on maint-branch integrations)

If it is uncertain all tests are run (for example if some are in a
signal handler), it is very important to have that count explicitly,
or else you won't notice missing tests. I think the problem was that
you used the simple countless version. When used with a count, it
offers the same guarantees as plan does, with the additional benefit
that you can postpone planning. E.G.

$count += 3
# This should be 3 tests

$count += 6
# 6 tests

done_testing($count);



Leon


demerphq at gmail

Sep 14, 2012, 5:01 AM

Post #10 of 11 (121 views)
Permalink
Re: [perl #114296] Refactor t/op/lop.t to use test.pl instead of making TAP by hand [In reply to]

On 14 September 2012 13:34, Dave Mitchell <davem [at] iabyn> wrote:
> On Wed, Aug 29, 2012 at 09:36:18PM +0100, Nicholas Clark wrote:
>> On Sat, Jul 28, 2012 at 02:21:05PM -0700, Colin Kuskie wrote:
>> > I stayed away from using done_testing in this patch since someone
>> > corrected one of the earlier ones where I did use it.
>>
>> We don't all agree on everything. I personally tend to find it easier
>> (because I hate repeatedly re-editing test conts, and I guess historically
>> I also got burned by them often conflicting on maint-branch integrations)
>
> As the 5.10.1 maint pumpking, I also hated all the merge conflicts caused
> by updates to the test count. However, I *really* hate the idea that some
> tests are quietly dying or misbehaving or being skipped, and we never
> notice.
>
> I've wondered from time to time whether the test infrastructure could be
> made to deduce the test count from code comments, e.g.
>
> plan(use_comments);
>
> # TESTS=2
> {
> is(...);
> is(...);
> }
>
> # TESTS=3
> {
> is(...);
> is(...);
> is(...);
> }
>
> so plan() scans the source file and sums all the TESTS=N.

Some of the regex tests used to do this via a BEGIN.

BEGIN { $testcount+=3 }

and then the $testcount was used in the plan.

But the code police decided this was bad style and patched it away
and I didn't notice until it was pretty much done. I always thought it
was a better solution than a hard coded test count.

cheers,
Yves


--
perl -Mre=debug -e "/just|another|perl|hacker/"


shlomif at shlomifish

Sep 14, 2012, 5:26 AM

Post #11 of 11 (122 views)
Permalink
Re: [perl #114296] Refactor t/op/lop.t to use test.pl instead of making TAP by hand [In reply to]

Hi Dave,

On Fri, 14 Sep 2012 12:34:46 +0100
Dave Mitchell <davem [at] iabyn> wrote:

> On Wed, Aug 29, 2012 at 09:36:18PM +0100, Nicholas Clark wrote:
> > On Sat, Jul 28, 2012 at 02:21:05PM -0700, Colin Kuskie wrote:
> > > I stayed away from using done_testing in this patch since someone
> > > corrected one of the earlier ones where I did use it.
> >
> > We don't all agree on everything. I personally tend to find it
> > easier (because I hate repeatedly re-editing test conts, and I
> > guess historically I also got burned by them often conflicting on
> > maint-branch integrations)
>
> As the 5.10.1 maint pumpking, I also hated all the merge conflicts
> caused by updates to the test count. However, I *really* hate the
> idea that some tests are quietly dying or misbehaving or being
> skipped, and we never notice.
>
> I've wondered from time to time whether the test infrastructure could
> be made to deduce the test count from code comments, e.g.
>
> plan(use_comments);
>
> # TESTS=2
> {
> is(...);
> is(...);
> }
>
> # TESTS=3
> {
> is(...);
> is(...);
> is(...);
> }
>
> so plan() scans the source file and sums all the TESTS=N.
>

This is the premise of my Test-Count CPAN distribution:

https://metacpan.org/module/Test::Count

Although what I do there is rely on an external process to process the code and
update the count based on the annotations rather than on the plan scanning
the source at every time.

Regards,

Shlomi Fish

--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
What does "Zionism" mean? - http://shlom.in/def-zionism

Trying to block Internet pornography is like climbing a waterfall and trying
to stay dry. (— one of Shlomi Fish’s Internet Friends)

Please reply to list if it's a mailing list post - http://shlom.in/reply .

Perl porters RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.