This repo is a simple example of how to use the Lest testing framework, which you can find at https://github.com/TAServers/lest.
The program itself simply prints the sum of 1 and 2 to console.
Run the tests locally by downloading the latest release bundle for Lest and running lua lest.lua from the project directory. You can run it with a working directory elsewhere, but you will need to manually set the config path when invoking Lest and update the config to match the tests correctly.
.github/workflows/test.yml- GitHub workflow which tests the program on commit using the Lest GitHub Actionsrc/- The source code for the programmain.lua- Entrypoint of the programmain.test.lua- Unit tests formain.lua. Showcases module and function mockingsum.lua- Dependency ofmain.luathat exports a function which returns the sum of two numberssum.test.lua- Unit tests forsum.lua. Very simple example of unit testing with no mocking.
tests/- Tests for the program that don't specifically relate to a single source file (integration, end to end etc.). A convention and not a requirement of Lestintegration.test.lua- Simple integration test of the whole program
.gitignore- Used to ignore a local copy of Lest in this instancelest.config.lua- Contains configuration options for Lest,