On 19-Feb-09 12:02, Luc Hermitte wrote:
> I've finally implemented my own unit testing plugin for vim. 
> 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.
>  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'
and/or specify expected messages in file 'test001.msgok'
/\d\+ lines changed/
use an input file 'test001.in'
write a short test script 'test001.vim'
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
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:
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/
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php