VUnit provides a JUnit/PyUnit like unit test framework for vim scripts. Tests are written in vimscript and can be run at the command line using either a python test runner or using an ant task.
Here is an example test case that tests autoindent with tab expansion in a vim file:
function SetUp() set expandtab shiftwidth=2 tabstop=2 endfunction function TestTabExpand() set ft=vim call append(0, ['if 1', 'endif']) call cursor(1, 1) normal oecho 'test' call vunit#AssertEquals(getline(2), " echo 'test'") endfunction
See the vim help file for full documentation.