Friday, October 20, 2017

Re: Advice needed: best practices for vim plugin testing

On 23:49 Thu 19 Oct , Felipe M. Vieira wrote:
> On Thu, October 19, 2017 at 23:36, Marcin Szamotulski wrote:
> > On 11:10 Thu 19 Oct , Felipe Vieira wrote:
> > > Hi everyone,
> > >
> > > I've been trying to develop a plugin and I'm used to writing testing for the
> > > softwares I develop. The problem is that I cannot find a suitable testing
> > > platform for vim plugins. This makes me feel uncomfortable in pushing
> > > improvements made on my own fork of a bigger project (this may adversely impact
> > > hundreds of users, and I think the codebase is complex enough; tests would
> > > force some adherence to what is already coded and improve the plugin itself).
> > >
> > > I have tried a couple of other vim plugins for testing with little/no success.
> > >
> > > **What currently is the best practice for developing vim plugins?**
> > > (preferably an official vim testing platform for plugins)
> > >
> > > It is needless to say how important is to develop tests for software (this is
> > > beyond the point here).
> > >
> > > I don't thinks this information is very relevant but:
> > >
> > > * I have some experience with vimscript
> > > * I program in python most of the time
> > > * The plugin is: https://github.com/python-mode/python-mode (my own fork:
> > > https://github.com/fmv1992/python-mode)
> > > * I am willing to learn whatever it takes to be able to develop testing for my
> > > plugin (as long as it is something 'official/stable')
> > >
> > > Best,
> > >
> > > Felipe.
> >
> > Hi Felipe,
> >
> > I've been missing a testing suite for vim too. One possible solution is
> > to use the same technique that vim is using itself to test the code.
> > There are now bunch of assert functions (:h assert_equal(), etc.).
> >
> > Another thing that would be awesome is to have a PureScript backend
> > for VimL and develop vim plugins in a strongly typed language. That would
> > rule out a lot of bugs. There is Python backend for Purescript which
> > one could use to write plugins that are using vim python interface.
> >
> > Cheers,
> > Marcin
>
> Marcin,
>
> thanks for the tips.
>
> I was aware of the 'assert_' family. They are useful if someone is checking
> function correctness and the like.
>
> However my concerns are broader as I'm trying to figure out ways of having a
> vim project maintained by different people but enforcing that their coding
> standards/modifications adhere to a test framework.
>
> As such I was thinking of ways of vim syntax checking (if proposed git/github
> modifications were syntactically correct) and their results as well (for
> instance having a vim command issued like 'PythonEnfoceCodingStandard' and be
> sure that a test buffer changed).
>
> And to be 100% honest I don't know exactly what I want. That's why I do know
> that there is a gap/need to contribute to vim in this point but I don't think I
> have enough practice with coding to tackle this issue myself.
>
> I'll let everyone know if I stumble upon something useful. Meanwhile lets hope
> others contribute to this post.
>
> Best,

For testing syntax one could use `synstack()` and `synIDaddr()` to test
if the file has the right syntax groups.

Best regards,
Marcin

--
--
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: