krzema12 / kotlin-python

Python target for the Kotlin Programming Language. See https://github.com/krzema12/kotlin-python/tree/python-backend/python
https://discuss.kotlinlang.org/t/idea-python-backend/19852
48 stars 1 forks source link

End-to-end tests #18

Closed krzema12 closed 3 years ago

krzema12 commented 3 years ago

The goal is to be able to assert on output that a given "Kotlin to Python" code and Python consumer produces. Each tests consists of 3 files: a Kotlin code that will be compiled to Python, a Python code that consumes the compiled code, and expected text output. The file names follow a certain convention - see run.sh to understand it.

I tried to add a test with factorial, but didn't manage to make it work. The Python code is generated a bit differently that you showed on Slack @SerVB, so maybe some extra changes are needed that you have locally? :)

Testing

image

krzema12 commented 3 years ago

maybe some extra changes are needed that you have locally?

Yep, I have some changes since I work on integers. They aren't ready still so I don't push them. Do you think I should?

No, it's OK, just wanted to ensure :) Please continue working on them and let's push it once you think it works fine.

I guess box tests contain similar cases too... However, I don't think it's a bit problem that we can have some duplicated tests.

Actually box tests are pretty limited because they only output "OK" if a given case passes . Here we can print whatever we want, both on Kotlin and Python level. Another argument was that I didn't want to change anything around box tests since they come from the upstream repo. And third one, as you said, these new tests are simple and can be used to easily demonstrate what works in Kotlin/Python :)