On Sun Aug 24 09:30:43 2008, [EMAIL PROTECTED] wrote:
>   I'm running coverage analysis to see whether there
> are any new branches/conditions in lib/Parrot/Configure/Compiler.pm
> which need testing.


I never cease to find coverage analysis rewarding for its ability to
enable you to spot dead code.  After running Devel::Cover over the
configuration and build tools, I noticed that lines 315-317 of
lib/Parrot/Configure/Compiler.pm had one-half of the branch and
two-thirds of the condition uncovered by the test suite.

    if ( !exists $options{file_type} && $target =~ m/makefile$/i ) {
        $options{file_type} = 'makefile';
    }

These lines were formerly found higher up inside genfile().   The more I
stared at them, the more I realized that they now duplicated code at
lines 298-301:

    if ( !exists $options{file_type}) {
        if ( $target =~ m/makefile$/i ) {
            $options{file_type} = 'makefile';
        }

So they could be excised.

I further realized that since with makefiles we always want
'replace_slashes' and 'conditioned_lines' to be enabled, we could
simplify this:

        if ( $options{file_type} eq 'makefile' ) {
            exists $options{replace_slashes}   or
$options{replace_slashes}   = 1;
            exists $options{conditioned_lines} or
$options{conditioned_lines} = 1;
        }

... to this:

        if ( $options{file_type} eq 'makefile' ) {
            $options{replace_slashes}   = 1;
            $options{conditioned_lines} = 1;
        }

... and in the process eliminate two conditions which were also coming
up short in coverage analysis.  Changes were committed in r30527.

kid51


Reply via email to