Has anyone looked into automating syntax tests for CI integration yet?
Dev Build 3092
You could play around a bit with github.com/randy3k/UnitTesting. Then you need to write a unittest suite that runs the syntax tests and compares results.
The tests themselves are triggered using the “run_all_syntax_tests” command, which internally calls the “hidden” sublime_api.run_syntax_test
API, and writes the results to the “exec” output panel. Thus, you either need to run the above command and compare output or run the run_syntax_test API yourself (suggested, since it allows you to only run the tests in your package).
sublime_api.run_syntax_test
expects a single parameter specifying the syntax test file to run, relative to the Data directory (as returned by sublime.find_resources
), and returns a string with the error text, if any. That means a test failed when it returned something that evaluates to True.
Actually, I think that this kind of test could be run by UnitTesting directly (maybe optional) since it would be the same for all kind of syntax tests anyway.
Problem: .sublime-syntax is still only on the Dev builds and to my knowledge, UnitTesting does not install those (it uses brew cask install
and apt-get
), nor does can insert the required license to where it needs to be.
The following C/C++ macros was not displayed correctly until v3083 (linux x86_64) was released:
#define max(a, b) ((a) > (b) ? (a) : (b))
#define sign(a) (((a) > 0) - ((a) < 0))
However, the bug was introduced back in v3092, where the variables “a, b” is not italic (using default scheme).
UnitTesting is updated to support testing syntax_test files on CIs. See: https://github.com/randy3k/UnitTesting-example/tree/syntax