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)

Thursday April 17, 2008
08:47 AM

Integrating Test::Class with Vim

[ #36173 ]

One problem which has long frustrated me has been typing ',t' in my editor (vim) and having it try to run tests against a "non-test" file. With my improved test mappings, I had partially solved this:

au! FileType perl          :call PerlMappings()
au! BufRead,BufNewFile *.t :call PerlTestMappings()

However, now that we're integrating Test::Class, this fails because test classes have a .pm extension. I've now solved this. All test classes are in the Test:: namespace. I can now mark these as 'tests' with this new vim mapping:

au! FileType perl          :call PerlMappings()
au! BufRead,BufNewFile *.t :call PerlTestMappings()
au! FileType yaml          :call YAMLTestMappings()
au! BufNewFile,BufRead *.pm
    \ if getline(1) =~ 'package Test::' |
    \     call PerlTestMappings()       |
    \ else                              |
    \     call PerlMappings()           |
    \ endif

Of course, this requires the package statement to be on the first line, but this is a minor limitation for the benefit we gain.

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.