EditorSyntax
EditorSyntax copied to clipboard
Enable Sublime Syntax testing framework
Please include in your contribution guidelines, instructions on how to run the syntax tests. I tried using the built in Sublime Text build system for Syntax Tests, and found that the files in this repo are using an invalid format for Sublime Text's test runner.
The header line refers to a scope, but it should be a syntax definition path/file name.
Some test assertion lines contain gaps on the assertions, which are currently not supported in Sublime Text.

If this is fixed, it would be possible to use continuous integration with Sublime Text's headless syntax test runner, to verify that PRs have no failing tests.
In the README we have instructions on how to build and run the tests. It uses the atom-grammar-test package which does something similar to what you describe (only with Atom) and it already gets run in CI.
So the good news is that we're already doing what you want.
That said, it would be cool to test against multiple text editors if the tests could be reused. Especially because the atom-grammar-test has to download Atom to test - and I'm guessing the Sublime headless test runner requires Sublime.
If we supported both, that might be nice to allow folks to test using the editor they already have, rather than having them download 100mb+ for "tests".
If we supported both, that might be nice to allow folks to test using the editor they already have, rather than having them download 100mb+ for "tests".
I'm happy to support both but I do not have a license for Sublime at the moment. I'll need to buy one but it will be a few weeks, I'm moving at the moment.
Apologies for not checking the readme thoroughly enough, for some reason I expected to find it in the contributing guide instead, so thanks for pointing me in the right direction. :+1: I wonder why the Atom devs chose to make a similar but slightly different test file format than the one that has been documented at http://www.sublimetext.com/docs/3/syntax.html#testing for years.
You can check the Sublime HQ Packages repo for their CI setup - it just requires a < 2 MiB download of the standalone headless syntax test runner tool.
I'll take a look. Depending on how similar the two formats are we may be able to write a simple translation script so we don't have to maintain two files.
Is the Sublime test runner tool open source? I'm having a hard time finding it. I'm also a little concerned about the what the license will be for the test runner since Sublime itself isn't free - but I would hope that the test runner would be ok to use.
it's not open source, but you can download it from https://download.sublimetext.com/latest/dev/linux/x64/syntax_tests and see the license:
The SOFTWARE PRODUCT (SUBLIME TEXT SYNTAX TEST RUNNER) is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The SOFTWARE PRODUCT is licensed, not sold.
LICENSES
SUBLIME TEXT SYNTAX TEST RUNNER is licensed for the purpose of running syntax definition tests on continuous integration services only. No other usage of SUBLIME TEXT SYNTAX TEST RUNNER is allowed.
DESCRIPTION OF OTHER RIGHTS AND LIMITATIONS
Maintenance of Copyright Notices.
You must not remove or alter any copyright notices on any copy of SUBLIME TEXT SYNTAX TEST RUNNER.
Distribution.
You may not distribute SUBLIME TEXT SYNTAX TEST RUNNER to third parties.
COPYRIGHT
All title, including but not limited to copyrights, in and to SUBLIME TEXT SYNTAX TEST RUNNER and any copies thereof are owned by SUBLIME HQ PTY LTD.
NO WARRANTIES
SUBLIME HQ PTY LTD expressly disclaims any warranty for SUBLIME TEXT SYNTAX TEST RUNNER, which is provided 'as is' without any express or implied warranty of any kind, including but not limited to any warranties of merchantability, non-infringement, or fitness of a particular purpose.
LIMITATION OF LIABILITY
In no event shall SUBLIME HQ PTY LTD be liable for any damages due to use of SUBLIME TEXT SYNTAX TEST RUNNER, to the maximum extent permitted by law. This includes without limitation, lost profits, business interruption, or lost information. In no event will SUBLIME HQ PTY LTD be liable for loss of data or for indirect, special, incidental, consequential (including lost profit), or other damages. SUBLIME HQ PTY LTD shall have no liability with respect to the content of SUBLIME TEXT SYNTAX TEST RUNNER or any part thereof, including but not limited to errors or omissions contained therein, libel, trademark rights, business interruption, loss of privacy or the disclosure of confidential information.
Interesting. From the wording it looks fine - however I should check with legal about this first. Don't want to be the guy who gets Microsoft sued 😅 also marking up for grabs.