Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

Ovid
  (email not shown publicly)
http://publius-ovidius.livejournal.com/
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Friday November 07, 2008
08:51 AM

TestModuleCoverage Update

[ #37823 ]

Recently I listed a vim function which allows you to run all tests which cover the module you're editing. As it turns out, there's a tiny bug in Devel::CoverX::Covered which causes it to sometimes store historical information and you might get a report back for a test which doesn't exist. I've emailed the author (no bug report as it might be a mistake on our end), but until it's cleared up, here's a corrected vim function:

function! TestModuleCoverage()
    let filename = bufname('%')

    let tests = system(
        'for file in $(covered covering --source_file="'. filename .'"); '
    \  . 'do if [[ -f "$file" ]]; then echo $file; fi; done')

    let result  = split( tests, "\n" )

    if empty(result)
        echomsg "No tests found for: ". filename
    else
        execute ':!prove  ' . join(result)
    endif
endfunction

I'm not exactly a bash wizard. If you can suggest a better way of checking that those files exist, I'd welcome it.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I can add a command line option to only list files that are in the file system.

        --require_file_present
        --require_file_present=../../trunk/lib
    or something like that.

    I'll think about the name a bit more.