https://github.com/terminaldweller/luactest
Run tests for your C functions from Lua semi-automatically.
https://github.com/terminaldweller/luactest
automation c lua test
Last synced: about 2 months ago
JSON representation
Run tests for your C functions from Lua semi-automatically.
- Host: GitHub
- URL: https://github.com/terminaldweller/luactest
- Owner: terminaldweller
- License: mit
- Created: 2019-05-19T13:12:44.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-03-05T02:48:43.000Z (over 6 years ago)
- Last Synced: 2025-09-29T15:58:17.406Z (9 months ago)
- Topics: automation, c, lua, test
- Language: C
- Homepage:
- Size: 417 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/bloodstalker/luactest)
[](https://lgtm.com/projects/g/bloodstalker/luactest/alerts/)
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fbloodstalker%2Fluactest?ref=badge_shield)
# luactest
The idea is to be able to write and run tests for C functions in Lua. inspired by me being lazy and my life being too short for writing tests for C in C.
The workflow is the clang libtooling tool under `libtool` will find the funcitons and add their lua wrapper into source code and register it with lua. `luatablegen` is a python script that takes an XML script describing your C structs and turns them into lua tables since almost every non-toy C code uses structs anyways and adding C structs as Lua tables is non-trivial. after that you just build the tool(its not a typo, you actually build your tool) which is a Lua 5.3 interpreter. you then write your test scripts in Lua and run them. `linenoise` is there to give you some basic cli functionality if you choose to run the tool in interactive mode. the `default.lua` file works as the dot file. The default provided will add your `luarocks` libraries to our custom Lua instance for some added quality of life.
## Demo
you can run the makefile in the root directory. then run the executable, type in `dofile("./test.lua")`and see the result. it runs our little test function from Lua which converts a string into an integer.
## TODO
* write the libtooling tool.
* need to add completion and hints for `linenoise`.
* add non-interactive execution to tool.
* add cygwin support because i have to use windows at work...
## Notes
The `luarocks` feature work for Lua 5.3. I haven't looked at the Lua 5.4 changelog yet.
## Build
If you don't have clang, subtitute all `make` commands with `make CC=gcc`.
Then run:
```sh
git clone https://github.com/bloodstalker/luactest
git submodule init
git submodule update
make
```
To build the libtooling tool run make under `libtool` directory.
The tool right now should support LLVM 5,6,8 and 9(latest tested trunk:355787).
## License
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fbloodstalker%2Fluactest?ref=badge_large)