Monday, February 12, 2018

Re: Advice needed: best practices for vim plugin testing

Hi everyone,

Thanks for all the valuable suggestions.

The method I found out to be the most suitable, dependecy free and sane
(this is highly personal) was to write bash tests which in turn invokes
vim with a given number of flags and which sources a given script which
ends with either "qall!" (exit code 0) or "cquit!" (exit code 1). You
can check an example of such tests in:

1. https://github.com/python-mode/python-mode/blob/develop/tests/test.sh
2. https://github.com/fmv1992/vim_dictionary/blob/dev/tests/test.sh

Example:

Bash invokes:
$ vim -i NONE -u /tmp/vimdict_vimrc -c 'source ./test_procedures_vimscript/lookup1.vim' /tmp/vimdict_disposable.py

File `./test_procedures_vimscript/lookup1.vim` has:
~~~~~~
" [...]
" Put assertions before.
call assert_true(bufexists('vim_dictionary-scratch'))

if len(v:errors) > 0
echom "Exiting lookup1 with errors" . join(v:errors, '|')
cquit!
else
qall!
endif
~~~~~~

It is also worth noting that vim's `verbosefile` option is valuable as
well.

Best wishes for the vim community,

--
Felipe Martins Vieira
I have transitioned to a new pgp key. Check my statement at:
https://drive.google.com/open?id=1Hoaedh6tIss0P7TYHYZFIqyOy8jBbb7FNhYtO2RzCb8
New Key Fingerprint: 4723 61F6 81DE A694 4060 D2BE ABD6 D936 A5B9 9720
Mobile +55 11 971 066 250

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment