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.
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. (Example: To test a :%s/../../-like command, you'll have
to do a lot of :Assert getline(1) == 'foo', :Assert getline(2) == 'bar', etc.)
Additionally, the testing framework (especially the reporting of test results)
may interfere with the object-under-test (e.g. when the test output is
presented
in a separate buffer that the object doesn't expect to exist).
So I ended up using VimTAP
(http://www.vim.org/scripts/script.php?script_id=2213) for actual unit-level
tests, and comparing the saved buffer output with expected output outside of
VIM, similar to what the 'make test' VIM selftests included in the VIM sources
do.
-- regards, ingo
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---