p4t5h3 / purebasic-language-for-sublime-text

PureBasic support for Sublime Text.
MIT License
4 stars 1 forks source link

Package Path in Syntax Tests: Use Package Name Instead of Repository Name #39

Closed tajmone closed 2 years ago

tajmone commented 2 years ago

Currently, all the syntax tests files have the following opening line:

; SYNTAX TEST "Packages/purebasic-language-for-sublime-text/PureBasic.sublime-syntax"

which means that the tests can only work if the repository was cloned in the Packages folder as is (i.e. with its original repository name).

Since I've cloned the repository forcing its folder name to PureBasic/, in my local working branch I had to tweak the first line of all the test files to:

; SYNTAX TEST "Packages/PureBasic/PureBasic.sublime-syntax"

The problem here is that the actual folder name for the package installed via Package Control is PureBasic/, not the repository name — as configured in Package Control JSON settings.

While right now this might not seem a problem, since syntax tests are export-ignored from the actual package, so only developers and contributors have access to them, if we were to add Python plugins to the package then it would either work for the installed package or its developers — but not for both, since path references would differ!

I strongly suggest that you rename your local clone to PureBasic/, like I did, and then we amend the package path in the test files accordingly, so that we can work with the same environment settings as the final users of the package.

p4t5h3 commented 2 years ago

I see. I did not notice Package Control using the package name instead of the repository yet. I renamed my local package folder and updated the test files accordingly.

p4t5h3 commented 2 years ago

No wait, now there is the the issue with the automated tests. When I set them up I had to fiddle around with the path already. The Sublime Text tests use the repository slug instead of the Package Control name because the latter is not involved.

p4t5h3 commented 2 years ago

See #40 for why this is resolved and the tests are working again.

tajmone commented 2 years ago

No wait, now there is the the issue with the automated tests.

Ah! Didn't consider that at all! I like your solution, is practical.

Unfortunately I never tried to implement syntax validation for ST package repositories — just code style consistency checks. Also, I've never used GitHub Actions/Workflows, just Travis CI — too much documentation to read, and I prefer Travis since it provides VMs for Windows, Linux and macOS (even with free account).

I wish I remembered where I saw that package repository that used the Python library I mentioned to validate the syntax tests and other aspects of the repository — i.e. unless I misunderstood it, since it was late at night. But I remember visiting the library repository and sifting through the documentation, and that it provided an alternative to using the official ST binary for testing syntaxes, using Python instead (probably still installs ST on the VM though, just runs the tests via CLI invocation).

If I come across that Python library I'll drop a link here.