Closed krzema12 closed 2 years ago
Left to do: add tests.
@SerVB I actually have no idea how to implement the tests easily for the main
function. Box tests: they rely on calling the box
function. End-to-end tests: apart from the fact they would need to be enhanced to call the module as a main one, not the library (easily doable), we miss the ability to print something - translation to println
in our backend doesn't work yet. Let me resolve it for now, unless you come up with some feasible way to test it.
Probably we can:
external fun print
or another one that has a visible side effect and call it from our main
.__main__
and import it from a py consumer. In our main
, we can modify a global var and access it from the consumer (as we do in an e2e test already).main
is called is to create an exception there (even not via throwing that we don't support yet but do something like 0 / 0
for arithmetic exception), it should be visible in stderr.Some combination of those points could work, but maybe not...
For now, a combination of 3 and 4 looks workable
Nice ideas, I'll give them a shot, thanks!
The goal is to be able to create a CLI, so that the compiled module can be called like
python3 out_ir.py --some --arg 123
and it will be available in Kotlin'sfun main(args: Array<String>)
, in simple cases justfun main()
.