Hello,

"Ingo Karkat" <sw...@ingo-karkat.de> wrote :

> On 07-Feb-09 12:39, Luc Hermitte wrote:
> > My few requirements, in case it helps:
> > - we should be able to test values with very simple things like:
> >    :Assert value < 42
> > - the result should end in the quickfix window (which implies 
> >   a first pass on functions/files to determine the current line 
> >   where the Assert is used)
> > - it would be nice to test mappings/commands/abbreviations/...
> >   definitions, buffer alterations, etc.
> > - setup/teardown support would be nice also.
> 
> Thanks for your list.

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!).

However I've made a different design choice: my plugin acts as a 
preprocessor. Thanks to that, I'm able to know the line where an 
assertion failure occurred, and I'm also able to handle expressions 
with script-local s:variables. 
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.
[It could be possible to process regular scripts with my plugin, in
order to do DbC by working on "debug"-enabled plugins, but I'm not sure 
it worth it]

BTW, tAssert provides convenience functions that my script don't (yet?).
At first, I wondered if both plugins should be merged. But as the engines 
are quite different, I'm not sure it makes any sense.


> What prompted me to start my implementation is that though it's
> trivial to come up with some :Assert commands, these cover the unit
> testing part well (i.e. checking that MyFunc('foo') does return 'bar'), 
> but are of little help when testing the effects of custom mappings and 
> commands, what most scripts and tips on vim.org are about.

That's true. However, it should be possible to provide convenience 
functions that help checking a buffer content.


[1] http://code.google.com/p/lh-vim/wiki/UT
NB: for once, I've written a script that depends on no other
script -- even if it can take advantage of BuildToolsWrapper if it 
is detected.

PS: shouldn't the discussion move to vim_use ?
-- 
Luc Hermitte
http://lh-vim.googlecode.com/
http://hermitte.free.fr/vim/

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui