Slash Boxes
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)

  (email not shown publicly)
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 August 28, 2003
01:25 PM

Accelerated testing

[ #14370 ]

The high level of Vim Fu here at work is simply astounding. While it will be a while before I even come close to the level of other people here, perhaps one of the most useful tricks I've found is this little line in my .vimrc: map ,r :! eval "./%" <cr>. (I don't know if that's the best syntax). Now, when I'm in command mode, ",r" will automatically run the program that I am editing (my test program, usually). My next hack will be to map a command to grind, my test program to run all tests.

Other things they do: when in a test, typing ",t" will run the test, ",gi" will go to the implementation (the module you're testing) and ",gt" will go back to the test for that module. It's marvelous how fast that speeds up testing.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Care to share a few implementations? I'd be particularly interested in running the test file and filtering out all successes. (If that means writing to Test::Harness::Straps, so be it.)

    • They use custom test modules they wrote a while ago, so much of their implementation is based upon knowledge of their test modules and how they're structured. I haven't thought of a more generic way of doing it.

      Unless I misunderstand you, perhaps a naive implementation in your .vimrc would be map ,t !eval "./%" | grep "^not"?

      That will make the "not ok" show up and the error data is written to STDERR, so that also would not be filtered.
    • Run the same using tv -q from Test::Verbose.
  • I'd be very interested in seeing some more of these useful vim mappings. I've been digging vim ever since I started playing with Red Hat back in Jan 2002, (and have gone so far as to install a Mac OS Classic version of vim on my PPC 7600 running OS 8.6)

    I've gotten a lot of vim knowledge thanks to MetaCosm's IRC-style tutorial [] (which seems to be down at the moment but you can find it cached on google), and the #vim channel on, but fresh input from people that know some serious vim-fu woul

  • You don't even need the eval. I have two mappings for doing something with the current file:

          map ü :!perl -w %
          map ö :!perl -wc %

    So 'ö' will syntax-check the current file (I hope the German umlauts will be visible to non-Germans as well). The disadvantage of that, I just realize, is that mine has the interpreter to use hardwired in and wont respect the she-bang line.

    But indeed, vim is pretty amazing even though I am myself only scratching on
    •     :!./%
      is even more simple. That's what I use ;-) although
      is also useful. (Quote the pipe with \ in maps.)

      My favorite vim map is amazingly simple :
          vmap * y:let@/=@"<CR>n
      Select a word or part of a word in visual mode, enter '*', and voilà, you're searching for this word.
      • :!./%
        Windows doesn't seem to like that, but specifying 'perl %' as the command does work. Either way, I really need to learn some vim; I'm still using it like it's plain vi.