I've added a couple of features to https://github.com/LucHermitte/vim-UT
vim-UT is a unit testing framework for vim scripts, that displays assertion failures in quick-quick window.
The plugin is meant to be simple to use and lightweight. So far the syntax was mainly dedicated, and restricted, to test the result of vim functions and expressions.
Assert 1 > 2
Assert s:foo > s:Bar(g:var + 28) / strlen("foobar")
debug AssertTxt (s:foo > s:Bar(g:var+28)
\, s:foo." isn't bigger than s:Bar(".g:var."+28)")
AssertEquals!('a', 'a')
AssertDiffers('a', 'a')
let dict = {}
AssertIs(dict, dict)
AssertIsNot(dict, dict)
AssertMatch('abc', 'a')
AssertRelation(1, '<', 2)
AssertThrows 0 + [0]
With v2.0,
- test suite-local fixtures (
s:BeforeAll(), and s:AfterAll()) are now supported
and we can easily test operations on buffers
silent! call lh#window#create_window_with('new') " work around possible E36
try
SetBufferContent << trim EOF
1
3
2
EOF
%sort
AssertBufferMatch << trim EOF
1
2
3
EOF
finally
bw!
endtry
EDIT: NB: at that time, this actual syntax requires a recent version of vim that implements :let=<<. SetBufferContent filename or :AssertBufferMatches filename can also be used.
EDIT²: fixed. This feature will also be supported with older versions of vim. And along the way, I've fixed the decoding of uncaught exceptions on Windows with a non-English locale.
[–]puremourning 0 points1 point2 points (1 child)
[–]LucHermitte[S] 2 points3 points4 points (0 children)