• Debugging Lua scripts running in Neovim

    In a previous blog post I wrote about testing Lua scripts in Neovim using the busted test framework. Today I want to look at how to debug Lua scripts in Neovim using the Debug Adapter Protocol (DAP). Just as before with busted, our problem is that we need to use Neovim as our Lua interpreter because we want to use Neovim's Lua API. At the same time, the debug adapter expects the Lua interpreter to conform to Lua's command-line interface. That's right: we need another command-line interface adapter.

    Continue reading…

  • Writing a ring buffer TDD style

    Let's write a ring buffer in Python! OK, that's not particularly exciting. Let's use test-drivent development, that should make things a bit more interesting. In this blog post I will go over the individual steps and my train of thought, because TDD requires a certain discipline and mindset. Why a ring buffer? A ring buffer is not quite trivial to implement because it has a couple of edge cases, but at the same time it is not hard to implement either. This is a post to follow along at home, so grab your text editor and let's get going.

    Continue reading…

  • Testing Neovim plugins with Busted

    The most annoying part about writing plugins for Neovim has been the lack of a good test framework. There are a couple of frameworks, and Vader has been my favourite so far, but they all have their downsides. This made me wonder: why limit myself to Vim/Neovim test frameworks? We have a full Lua runtime, and other people already have solved the testing problem for Lua. Busted does 90% of what we need, so let's fill in the remaining 10%. The following is based on my experience with adding tests to rainbow-delimiters.nvim.

    Continue reading…