Yo dawg, I heard you like Neovim, so I put a Neovim inside your Neovim, so you can edit while you edit! Ahem... anyway, in my previous post I proposed a plugin which would make it easier to control an embedded Neovim from within Neovim. So I went ahead and wrote yo-dawg.nvim (GitHub mirror), named after the “Yo dawg” internet meme.
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.
A lot of new Neovim plugins come with a
setupfunction which lets you specify the settings of the plugin. Users are expected to call that function with a table as arguments which contains the user's personal settings to override the defaults. This works, but Lua is all about tables, so let's look at an alternative.