New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Atom-Grammar-Tests #254

Merged
merged 5 commits into from May 3, 2018

Conversation

Projects
None yet
4 participants
@kevinastone
Contributor

kevinastone commented Apr 22, 2018

Description of the Change

Introduce syntax tests to improve the test coverage. Anticipating changes for the tree-sitter migration (cc @maxbrunsfeld + @ambv), we'd benefit from having a more complete set of grammar tests to ensure compatibility. This begins developing those test fixtures.

This introduces a few syntax fixture files and fixes a bug with missing vararg and kwarg syntax highlighting.

Benefits

atom-grammar-test is a test helper to allow you to provide code snippets and examples that you annotate with the desired syntax rules. It makes it much easier to validate the grammar rules and allows parties to provide examples of missing of errant syntax highlighting.

Possible Drawbacks

Dependency on another package? It's been used by several atom language grammars to date.

Applicable Issues

N/A

@ambv

This comment has been minimized.

Contributor

ambv commented Apr 22, 2018

This is very cool. I'll leave merging to @50Wliu or @maxbrunsfeld but +1 from me.

I'd like more comprehensive grammar fixtures though. I can generate you some more code for this later.

@kevinastone

This comment has been minimized.

Contributor

kevinastone commented Apr 22, 2018

@ambv, yep! I wanted to see if this would land before committing to more fixtures. Just working on this exposed quite a few gaps in the grammar (type annotations, punctuation, etc)

grammarTest path.join(__dirname, 'fixtures/grammar/syntax_test_python_lambdas.py')
grammarTest path.join(__dirname, 'fixtures/grammar/syntax_test_python_typing.py')
xdescribe "SQL highlighting", ->

This comment has been minimized.

@kevinastone

kevinastone Apr 22, 2018

Contributor

I disabled this section since it was failing for me. Does this work for others?

This comment has been minimized.

@kevinastone

kevinastone Apr 29, 2018

Contributor

Ignore this. It runs fine and I removed it.

@kevinastone

This comment has been minimized.

Contributor

kevinastone commented Apr 24, 2018

Also improved the Type declarations and added more syntax tests.

@50Wliu

This comment has been minimized.

Member

50Wliu commented Apr 27, 2018

Also improved the Type declarations

Could this be moved into a separate PR?

@kevinastone

This comment has been minimized.

Contributor

kevinastone commented Apr 29, 2018

Sure, will move to another PR: https://github.com/kevinastone/language-python/tree/typing-improvements
Removed the commit.

@kevinastone

This comment has been minimized.

Contributor

kevinastone commented May 1, 2018

Ready

@@ -19,6 +19,7 @@
"tree-sitter-python": "^0.11.3"
},
"devDependencies": {
"coffeelint": "^1.10.1"
"coffeelint": "^1.10.1",
"atom-grammar-test": "^0.6.4"

This comment has been minimized.

@50Wliu

50Wliu May 1, 2018

Member

I believe this needs to be in the dependencies section, or else tests won't run on atom/atom (atom/language-html@624139d). I don't think the situation has changed since that commit.

This comment has been minimized.

@kevinastone

kevinastone May 1, 2018

Contributor

weird. ok. fixed.

@50Wliu

50Wliu approved these changes May 1, 2018

This looks ok to me. I'll let it sit for a while longer to see if @maxbrunsfeld has comments.

@maxbrunsfeld

This comment has been minimized.

Contributor

maxbrunsfeld commented May 1, 2018

@50Wliu I'm pretty unfamiliar with the textmate grammars, so I'm good with this as long as it looks good to you.

@kevinastone just to check - have you done manual testing of your grammar changes to verify that everything looks good visually?

@kevinastone

This comment has been minimized.

Contributor

kevinastone commented May 2, 2018

@maxbrunsfeld yeah, it renders better due to support for asterisks in args and kwargs.

Before

screenshot 2018-05-01 21 31 00

After

screenshot 2018-05-01 21 30 41

@kevinastone

This comment has been minimized.

Contributor

kevinastone commented May 2, 2018

Bare lambda expressions are also fixed:

Before

screenshot 2018-05-01 21 33 51

After

screenshot 2018-05-01 21 34 11

@50Wliu 50Wliu merged commit 253d032 into atom:master May 3, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@kevinastone kevinastone deleted the kevinastone:syntax-test branch May 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment