Skip to content
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

Implement a Formatter for Tree-Sitter Grammar Tests in Darklang #5378

Open
OceanOak opened this issue May 28, 2024 · 0 comments
Open

Implement a Formatter for Tree-Sitter Grammar Tests in Darklang #5378

OceanOak opened this issue May 28, 2024 · 0 comments

Comments

@OceanOak
Copy link
Collaborator

OceanOak commented May 28, 2024

We tried to plug tree-sitter-tests-formatter in our repository, to format tree-sitter-darklang/test/corpus test files, but decided against it due to the 1.5 GB ( for Rust) it would add to the Dockerfile

We want to write a formatter for our Tree-sitter grammar tests in Darklang

Notes:

  • Handle nested directories : not all test files are in tree-sitter-darklang/test/corpus; some are in nested directories, e.g.tree-sitter-darklang/test/corpus/exhaustive/exprs
  • maintain a consistent number of # symbols at the beginning of each test header
  • trim test names
  • keep the test case as is (no trimming no formatting)
  • have a triple hyphen (---) separator between the test case and the generated tree
  • spacing rules: two newlines after each test block, one after each title, test case, and after the triple hyphen separator
  • format the S-expression based on the following example

Example of a formatted test:

==================
boolean - true
==================

true

---

(source_file 
  (expression 
    (simple_expression 
      (bool_literal)
    )
  )
)

Misc:

  • Run the script using the cli?
  • Figure out a way to run it in CI
@OceanOak OceanOak added the needs-review I plan on going through each of the issues and clarifying them -- this is to mark remaining issues label May 28, 2024
@OceanOak OceanOak removed the needs-review I plan on going through each of the issues and clarifying them -- this is to mark remaining issues label Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant