I would like to write some unit tests for Lua code being used by ConTeXt, and would like to know if anyone else has done this and what may be require in setting up the framework.
The Lua code in particular is being stored in separate files (e.g.
numbering.lua), meaning that a test runner (e.g. Busted) can just include them with
It may be worth noting (but probably does not matter) that I am using Python's unittest as a test runner with lunatic-python.
The inherent problem is that the globals defined by LuaTeX and ConTeXt are not naturally in Lua. Tables such as
texio are simply not accessible without a
require that imports them from their corresponding files. (Which looks to be
tex/texmf-context/tex/context/base/trac-log.lua and ...who knows, respectively).
Has anyone done unit testing of ConTeXt + Lua? What Lua files might one need to include to get the variables? I would expect there to be an entry-point somewhere that would take care of most of the setup.
It looks like the
.lua files of relevance would generally be in
./tex/texmf-context/tex/context/base/ but I am just guessing, and since there are around 840
.lua files I would be grateful for any guidance on where to start.