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.