According T3872, I have added some simple unit tests for lua backend, checking results with lua. The tests coverage some most common use. But not all tests pass completely: some tests skipped because of problems with the lua backend.
Details
- Reviewers
asemke - Group Reviewers
Cantor - Commits
- R55:4dafe08faa2b: Add unit tests for lua backends
R55:4b16e2adbd59: Add unit tests for lua backends
- run testlua
Diff Detail
- Repository
- R55 Cantor
- Branch
- add-lua-unit-tests
- Lint
No Linters Available - Unit
No Unit Test Coverage
Just a example of appearens input in output (i don't want add image in patch summary).
@filipesaraiva I have some troubles to compile&link the lua backend at the moment. Can you please help to validate this?
Lua's output for Cantor's input
"s=3;\nprint(s)"
is
"s=3;\n print(s)\n3"
I'm not sure how to fix this, this looks like a limitation of the interpreter. Let's disable/remove the tests failing because of this specific problem and add all the other tests which work. Having couple of tests is better than having no tests.
Well, I will do it, but first i want to spend some time for attempts to fix this problem, maybe i will find cause of this.
@asemke, I have tested this tests with D12074 and and everything seems to work, but with problems: for the some reason sometimes we start checking, before evualation have result (and even before evualation take output from lua interpreter). I think, I will investigate this situation and will try to achieve 100 percent passage of tests
Well, maybe I found the problem of unstable tests result: repeating lua input in output and not numbered line produce situation, that sometimes we end output parsing, because aviable lua output ends, but lua VM doesn't end work. For example, if we run
print(3) print(4)
We could end parsing after getting result of first command (if we read lua prompt before lua repeats the command to output, for this example, read > before print(4) will be writed in output chanell (there is delay between this moments)) and set status Done, but output don't end and we have result of second command in output.
I think, It's not a problem for Cantor GUI, because I haven't notice this problem, while I have worked with the worksheet, but it affects to test results.
I think, there are few ways to work with it:
- Change expresssion end condition: we know, that lua repeat all input to output, so we could wait, until read all input commands in output
- Just ignore this problem and run tests few times and take maximum of passed tests
Add skipping for tests, which not working because of problems unrelated to the tests.
Possible fail of the first test, because of problems with reading intro message. This is backend's problem, so I'll deal with this in another patch.