Closed p5pRT closed 11 years ago
I stayed away from using done_testing in this patch since someone corrected one of the earlier ones where I did use it.
Colin
On Sat Jul 28 14:21:04 2012\, colink@perldreamer.com 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
The RT System itself - Status changed from 'new' to 'open'
Here's a supplementary patch for that.
On Fri Aug 10 20:43:03 2012\, colink@perldreamer.com 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
I can give you another patch which removes that comment line\, but it was there before I started tweaking the test.
I also downloaded the two patches and applied them to a fresh copy of blead\, and they were clean. There's extra code either below the fold\, or down a screen.
I'll attach the combined patch and the patched result for comparison.
#!./perl
# # test the logical operators '&&'\, '||'\, '!'\, 'and'\, 'or'\, 'not' #
BEGIN { chdir 't' if -d 't'; @INC = '../lib'; require './test.pl'; }
plan tests => 17;
my $test = 0; for my $i (undef\, 0 .. 2\, ""\, "0 but true") { my $true = 1; my $false = 0; for my $j (undef\, 0 .. 2\, ""\, "0 but true") { $true &&= !( ((!$i || !$j) != !($i && $j)) or (!($i || $j) != (!$i && !$j)) or (!!($i || $j) != !(!$i && !$j)) or (!(!$i || !$j) != !!($i && $j)) ); $false ||= ( ((!$i || !$j) == !!($i && $j)) and (!!($i || $j) == (!$i && !$j)) and ((!$i || $j) == ($i && !$j)) and (($i || !$j) != (!$i && $j)) ); } my $m = ! defined $i ? 'undef' : $i eq '' ? 'empty string' : $i; ok( $true\, "true: $m"); ok( ! $false\, "false: $m"); }
# $test == 6 my $i = 0; (($i ||= 1) &&= 3) += 4; is( $i\, 7\, '||=\, &&=');
my ($x\, $y) = (1\, 8); $i = !$x || $y; is( $i\, 8\, 'negation precedence with ||' );
++$y; $i = !$x || !$x || !$x || $y; is( $i\, 9\, 'negation precedence with ||\, multiple operands' );
$x = 0; ++$y; $i = !$x && $y; is( $i\, 10\, 'negation precedence with &&' );
++$y; $i = !$x && !$x && !$x && $y; is( $i\, 11\, 'negation precedence with &&\, multiple operands' );
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-archive.perl.org/perl5/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@​perldreamer\.com 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
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
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@perldreamer.com 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
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]
Those lines (lines 52-54 after both patches are applied) lead into another test:
51 $x = 0; 52 ++$y; 53 $i = !$x && $y; 54 is( $i\, 10\, 'negation precedence with &&' );
Note\, there's a 2 line offset between the original patch and this code due to removing a comment and a blank line.
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.
On Wed\, Aug 29\, 2012 at 10:36 PM\, Nicholas Clark \nick@​ccl4\.org 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
On 14 September 2012 13:34\, Dave Mitchell \davem@​iabyn\.com 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/"
Hi Dave\,
On Fri\, 14 Sep 2012 12:34:46 +0100 Dave Mitchell \davem@​iabyn\.com 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 .
The discussion in this ticket wandered off from its original scope: Colin's refactoring of the test file to use t/test.pl.
AFAICT\, the tests have been working properly for months\, so I am closing this ticket. If anyone would like to continue discussing the best way to count tests\, I recommend writing P5P.
Colin\, thanks for your efforts on the test suite\, which have inspired myself and others!
Thank you very much. Jim Keenan
@jkeenan - Status changed from 'open' to 'resolved'
Migrated from rt.perl.org#114296 (status was 'resolved')
Searchable as RT114296$