cx-language / cx

C* is a hybrid low-level/high-level systems programming language focused on performance and productivity.
https://cx-language.github.io/
MIT License
130 stars 9 forks source link

Correct check-snapshots & handle paths with spaces #69

Closed xvrc closed 3 years ago

xvrc commented 3 years ago

When I went to run the tests, my console was flooded with Python stack traces during the snapshot tests from an error stating that unified_diff expects strings. It turns out that the (new?) default behaviour of subprocess.check_output is to return a bytes object instead of a string. Then, even if the contents were equal, the objects would always be different when compared, which would then lead to the bad unified_diff call.

I also added a fix for executing tests from a build folder that contains spaces. I'm not sure if it would be better to fix this on the command itself (in the CMake script), or just handle it in the LIT configuration.

As a side note, I noticed the GitHub workflow file sets up Python 2.7. Shouldn't it be bumped up to Python 3? (I was running the tests using Python 3.10 btw)

emlai commented 3 years ago

Yes you were right, the CI Python needed to be bumped to Python 3 as well. Thanks for the fixes!

I'm not sure if it would be better to fix this on the command itself (in the CMake script), or just handle it in the LIT configuration.

I think the LIT config is the best place. The LIT substitution system is kind of hacky anyway.