GildedRose-Refactoring-Kata/lua/README.md
Auclair Emmanuel d8f30fa8d3 add Lua lang
2025-09-02 15:34:44 +02:00

1.3 KiB

Gilded Rose starting position in Lua

I assume you have installed Lua on your system (version >= 5.1).

Install

If you want to use LuaRocks there is a config file that should install the dependencies nicely:

$ luarocks install --only-deps gildedrose-dev-1.rockspec

Run unit tests from the command line

The tests use the Busted tool.

$ busted

For coverage you'll need to install LuaCov

$ busted --coverage
$ luacov # generate the report

Run the TextTest fixture on the command line

$ lua src/main.lua 10

Run the TextTest approval test that comes with this project

There are instructions in the TextTest Readme for setting up TextTest. You will need to specify the executable in config.gr. Uncomment this line to use it:

executable:${TEXTTEST_HOME}/lua/texttest

The TextTest fixture use the ./texttest executable as a hack to make the require work. Lua does not have relative require and I did not find a simple way to implement them so the test need to run from the ./lua directory. I will improve this in the future if I learn how to do it better :)