-
Notifications
You must be signed in to change notification settings - Fork 180
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
Add Terraform language tmgrammar snapshots #914
Conversation
This adds a snapshot file for every language construct from https://www.terraform.io/language that makes sense to test syntax grammar for. Some constructs are left out because it does not make sense to test grammar for it now. A minimal listing of numeric and string functions are added to expressions_functions.tf, which is not the complete listing of functions. The existing grammar uses a regex with a list of function names, so this small list is enough to test at the moment. If we decide to change the regex for functions in the future, we should add more test cases to this file.
b35162a
to
5c5429d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming you know this and it may not matter for the static grammar - that some lines represent an expression which is only valid either within a template (i.e. "${ HERE }") or on the RHS from attribute name.
Co-authored-by: Radek Simko <radek.simko@gmail.com>
Correct, however we can't always check for things like that with the grammar how it is. For example, if we are inside a template or if we are in a tfvars file. There is some refactoring we can do to separate out those aspects, but these snapshots are an attempt to get a baseline of what we have now and what it lights up. |
Sorry for the delayed review. I've noticed that only the first snapshot test is being executed. I've raised #917 to address this. |
Apparently that's a platform specific glob problem, as it worked locally 😂 |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
This adds a snapshot file for every language construct from https://www.terraform.io/language that makes sense to test syntax grammar for. Some constructs are left out because it does not make sense to test grammar for it now.
A minimal listing of numeric and string functions are added to expressions_functions.tf, which is not the complete listing of functions. The existing grammar uses a regex with a list of function names, so this small list is enough to test at the moment. If we decide to change the regex for functions in the future, we should add more test cases to this file.