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)

Wednesday September 17, 2008
08:35 AM

Vim: run all tests in your buffers

[ #37470 ]

I often have a ton of tests open in one buffer. They're usually related to something I'm refactoring:

vim $(ack -l --perl 'api/v1/episode' t/)

So it's handy to be able to execute all tests in my current vim buffers. Now I can just type ,tb and do that.

map <leader>tb :call RunTestsInBuffers()<cr>
function! RunTestsInBuffers()
    let i = 1
    let tests = ''
    while (i <= bufnr("$"))
        let filename = bufname(i)
        if match(filename, '\.t$') > -1
            let tests = tests . ' "' . filename . '"'
        endif
        let i = i+1
    endwhile
    if !strlen(tests)
        echo "No tests found in buffers"
    else
        execute ':!prove ' . tests
    endif
endfunction

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.