TestModuleCoverage Update

Ovid on 2008-11-07T13:51:36

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.


Feature request

jplindstrom on 2008-11-07T15:37:12

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.