Closed versvisa closed 2 months ago
issue #120
As mentioned in the referenced issue, the "test fn" functions are currently only executed during the build process of the addon (as a mix between unit and regression tests).
It would be nice to have this generally available for stuff in "to2Local" as well. There are just some things to consider:
What I eventually want to explore is bundling a test-runner as a WASM, so that it could be easily integrated into anything javascript/typescript related and would be executed in a sandbox environment ... but again: Time and priority ;)
... and sometimes I just overthink it. pre-release 0.5.8.2 (https://github.com/untoldwind/KontrolSystem2/releases/tag/v0.5.8.2) now has console commands. One of the commands is "test" to run unit-tests.
test
should run all "test fn" that are defined anywheretest <module name>
should just run those of a specific moduleResults are reported in the Console window (so no extra UI necessary ;) )
I also overhauled the REPL execution: Expressions typed into the console should now behave the same as in scripts (it is running through the same compilation steps)
Now part of the regular release 0.5.8.3
Gorgeous.
Hello, I see there are a bunch of unit test functions of the form
test sync fn test_...() -> Unit = {
. How can I use that system for my own code? When and where are the tests executed?If it does not happen already, I suppose it would be good to run all tests (optionally) when "rebooting", i.e. loading/compiling the TO2 code.