On Thu, May 20, 2004 at 04:34:39PM -0400, Geoffrey Young wrote: > hi paul. > > I've found that in a statement like > > $x{foo} ||= 1; > > I can't ever satisfy the first condition in the "condition coverage" matrix > (0,0) since 1 is always true. is it desirable to remove fixed truth values > like this from the truth table?
Well, not to completely remove them, but certainly to downgrade then. There is already code in place to do that for cases such as C<my $r = $_ || "qqq";> but the different op tree in this case fooled me. This is unlikely to be the only case in which I have not fully understood the subtleties of the op tree, and so I am grateful for reports such as this. The following patch should fix it, and will be in the next release, hopefully coming next week: --- lib/Devel/Cover.pm.org 2004-05-18 01:31:08.000000000 +0200 +++ lib/Devel/Cover.pm 2004-05-21 00:55:13.000000000 +0200 @@ -638,7 +638,9 @@ sub add_condition_cover if ($type eq "or") { - my $name = $op->first->sibling->name; + my $r = $op->first->sibling; + my $name = $r->name; + $name = $r->first->name if $name eq "sassign"; if ($name eq "const" || $name eq "srefgen") { $c = [ $c->[3], $c->[1] + $c->[2] ]; > I tried taking a look at adding the condition to tests/cond_or but I really > couldn't grok the test suite at first glance :) It's not one of the more simple test suites out there, that's true. In part this is because testing requires running the test program in a new process under Devel::Cover, then running F<cover> to generate the results, then checking the results are correct. To do this, I use golden results. So the process is something like: - Add the code to the test program in tests/cond_or - Run make text TEST=cond_or and check the results are correct - Run make gold TEST=cond_or - Do this for perl5.6.1, 562, 580, 581, 582, 583, 594 and 592, threaded and unthreaded - Take appropriate shortcuts by examining the golden results in test_output/cover/cond_or.* and using all_versions - Try very hard not to mess up I've not really expected anyone else to do this up to now. Medium term, I'd like to improve this process, and I really want to find a way to run Devel::Cover on itself. Thanks again for the report. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net