Loading ...
Sorry, an error occurred while loading the content.
 

Re: Unit Testing for vim [Was: Vim Lib [Was: List Questions]]

Expand Messages
  • Ingo Karkat
    ... I ve just published a first version of my testing framework for VIM plugins. Whereas Tom s plugin is for Design by Contract, and Luc has started developing
    Message 1 of 7 , Mar 2, 2009
      On 19-Feb-09 12:02, Luc Hermitte wrote:
      > I've finally implemented my own unit testing plugin for vim. [1]
      > This is a first draft, and all comments are welcomed.
      >
      > The plugin has been strongly inspired by Tom Link's tAssert plugin
      > (thanks Tom!).
      >
      > ...
      >
      > My plugin is made for Unit Testing, and nothing else. We write an
      > independent UT script, and give it as argument to :UTRun command.
      >
      > On the other hand, Tom's plugin permits to Design scripts by Contract,
      > which is also extremely useful. i.e., it makes possible to place
      > assertions in regular Vim scripts (*-plugins). However by its design
      > choice, it cannot fills the quickfix window with the list of failed
      > assertions -- hence my NIH script.
      >
      > [1] http://code.google.com/p/lh-vim/wiki/UT

      I've just published a first version of my testing framework for VIM plugins.
      Whereas Tom's plugin is for Design by Contract, and Luc has started developing a
      unit testing plugin, my framework allows to write succinct automated regression
      test suites. I had been dragged down because of the immense testing effort
      involved whenever I made a modification to one of my published plugins. It is
      especially tedious to test for different VIM settings and to re-create failure
      conditions for custom commands and mappings.

      Now I can specify an expected output, e.g. in file 'test001.ok'
      expected output
      and more
      expected output
      and/or specify expected messages in file 'test001.msgok'
      /\d\+ lines changed/
      use an input file 'test001.in'
      ExPeCteD OuTpUt
      AND MORE
      ExPeCteD OuTpUt
      write a short test script 'test001.vim'
      edit test001.in
      normal! gg3guu
      write test001.out
      quit!
      and my framework invokes the test(s) [suites], compares the actual with the
      expected output, checks that the messages match, and prints any failures and a
      test summary:
      2 tests, 2 run: 2 OK, 0 failures, 0 errors.

      Unit tests can also be executed; I've chosen the VimTAP plugin because the TAP
      output is very easy to parse. However (since the quickfix buffer can be saved to
      a file, too), Luc's UT plugin could be used for unit tests just as well.

      It's no rocket science, just some (rather ugly) shell script driver, but it has
      totally changed the way I maintain and develop my plugins. Here's the link:
      http://vim.sourceforge.net/scripts/script.php?script_id=2565

      I mention this here in the hope that this may be useful to other script writers,
      too, or maybe just to inspire them to do more in the testing area, and
      potentially come up with a better alternative. Feedback is welcome.

      -- regards, ingo

      --
      -- Ingo Karkat -- /^-- /^-- /^-- /^-- /^-- /^-- http://ingo-karkat.de/ --
      -- http://vim.sourceforge.net/account/profile.php?user_id=9713 --


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    Your message has been successfully submitted and would be delivered to recipients shortly.