Integrating Lua tests with tasty-lua

I wrote a little utility, tasty-lua, to integrate Lua tests into tasty Haskell tests. It’s not much, but I liked how it turned out.

Background: pandoc ships with an increasing amount of Lua functions, most of which are implemented in Haskell (via HsLua). Tests for these functions were, well, not great. Testing from Haskell was cumbersome and failure reporting was bad. Installing a full Lua toolchain for testing would have been an option, but having to deal with a second language stack is annoying. The tasty-lua package is a more convenient way of solving this.

Tasty’s flexibility allowed us to create a bridge between Haskell and Lua tests. Tasty Lua comes with a (tiny) set of tools for writing tests in Lua. The Lua files can be invoked via a tasty provider, and the Lua test results are properly integrated into the test output. Everything that’s required for Lua testing can be installed via cabal/stack.

I was amazed by how easy it was to extend the tasty framework.

This is a small package and exists only to fill a very specific gap. But if you think about integrating Lua into your Haskell app, give tasty-lua a try.

1 Like